A:cf原题。当然是不是也没什么关系。

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
int read()
{
int x=,f=;char c=getchar();
while (c<''||c>'') {if (c=='-') f=-;c=getchar();}
while (c>=''&&c<='') x=(x<<)+(x<<)+(c^),c=getchar();
return x*f;
}
#define N 1000010
int n,a[N];
int main()
{
freopen("sequence.in","r",stdin);
freopen("sequence.out","w",stdout);
n=read();
for (int i=;i<=n;i++) a[i]=read();
sort(a+,a+n+);
cout<<a[n]-a[]-n+;
return ;
}

  B:非常裸的矩乘。

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
int read()
{
int x=,f=;char c=getchar();
while (c<''||c>'') {if (c=='-') f=-;c=getchar();}
while (c>=''&&c<='') x=(x<<)+(x<<)+(c^),c=getchar();
return x*f;
}
#define P 1000000007
#define N 9
int T,n;
struct matrix
{
int n,a[N][N];
matrix operator *(matrix b) const
{
matrix c;c.n=n;memset(c.a,,sizeof(c.a));
for (int i=;i<n;i++)
for (int j=;j<N;j++)
for (int k=;k<N;k++)
c.a[i][j]=(c.a[i][j]+1ll*a[i][k]*b.a[k][j]%P)%P;
return c;
}
}f,a,b;
int trans(int x,int y){return x*+y;}
int main()
{
freopen("food.in","r",stdin);
freopen("food.out","w",stdout);
T=read();
a.n=N;f.n=;
for (int i=;i<;i++)
for (int j=;j<;j++)
for (int k=;k<;k++)
if (!(i==j&&j==k)&&!(j==&&i+k==)&&!((j==||j==)&&(i==&&k==))) a.a[trans(i,j)][trans(j,k)]=;
b=a;
while (T--)
{
n=read()-;
if (n<) {printf("3\n");continue;}
a=b;
for (int i=;i<;i++) f.a[][i]=;
for (;n;n>>=,a=a*a) if (n&) f=f*a;
int ans=;
for (int i=;i<;i++) ans=(ans+f.a[][i])%P;
printf("%d\n",ans);
}
return ;
}

  C:非常显然的堆。

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<vector>
using namespace std;
int read()
{
int x=,f=;char c=getchar();
while (c<''||c>'') {if (c=='-') f=-;c=getchar();}
while (c>=''&&c<='') x=(x<<)+(x<<)+(c^),c=getchar();
return x*f;
}
#define N 100010
#define ll long long
int n,a[N],b[N],cnt;
ll delta;
priority_queue<ll,vector<ll>,greater<ll> >q;
int main()
{
freopen("snow.in","r",stdin);
freopen("snow.out","w",stdout);
n=read();
for (int i=;i<=n;i++) a[i]=read();
for (int i=;i<=n;i++) b[i]=read();
for (int i=;i<=n;i++)
{
q.push(a[i]+delta);cnt++;
ll ans=;
while (!q.empty()&&q.top()<=delta+b[i]) ans+=q.top()-delta,q.pop(),cnt--;
delta+=b[i];
printf("%I64d ",ans+1ll*cnt*b[i]);
}
return ;
}

  result:300 rank1

Contest 4的更多相关文章

  1. Programming Contest Problem Types

        Programming Contest Problem Types Hal Burch conducted an analysis over spring break of 1999 and ...

  2. hdu 4946 2014 Multi-University Training Contest 8

    Area of Mushroom Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) ...

  3. 2016 Multi-University Training Contest 2 D. Differencia

    Differencia Time Limit: 10000/10000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Tot ...

  4. 2016 Multi-University Training Contest 1 G. Rigid Frameworks

    Rigid Frameworks Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) ...

  5. hdu-5988 Coding Contest(费用流)

    题目链接: Coding Contest Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Ot ...

  6. ZOJ 3703 Happy Programming Contest

    偏方记录背包里的物品.....每个背包的价值+0.01 Happy Programming Contest Time Limit: 2 Seconds      Memory Limit: 65536 ...

  7. 2012 Multi-University Training Contest 9 / hdu4389

    2012 Multi-University Training Contest 9 / hdu4389 打巨表,实为数位dp 还不太懂 先这样放着.. 对于打表,当然我们不能直接打,这里有技巧.我们可以 ...

  8. 2014 Multi-University Training Contest 9#11

    2014 Multi-University Training Contest 9#11 Killing MonstersTime Limit: 2000/1000 MS (Java/Others)   ...

  9. 2014 Multi-University Training Contest 9#6

    2014 Multi-University Training Contest 9#6 Fast Matrix CalculationTime Limit: 2000/1000 MS (Java/Oth ...

  10. 校际联合Contest

    每次开一个坑都像是重新被碾压的预感 最近的新闻,以前很喜欢乔任梁的<复活>...然后他就死了...感觉我再多愁善感一点的话...就要悲伤逆流成河了吧... Contest 09/24(乐滋 ...

随机推荐

  1. 北京Uber优步司机奖励政策(4月16日)

    滴快车单单2.5倍,注册地址:http://www.udache.com/ 如何注册Uber司机(全国版最新最详细注册流程)/月入2万/不用抢单:http://www.cnblogs.com/mfry ...

  2. RHCSA-EXAM 模拟题目

    参考答案:http://www.cnblogs.com/venicid/category/1088924.html 请首先按找以下要求配置考试系统: * Hostname: server0.examp ...

  3. mysql增删改查、连表查询、常用操作

    一.建表 1.最简单的建表CREATE TABLE user(id int,name char(20),age int); 2.带主键带注释和默认值创建表CREATE TABLE  user(id I ...

  4. Jmeter接口测试(一) Jmeter简介

    一.Jmeter介绍 (一)Jmeter简介 Apache JMeter 是 Apache 组织的开放源代码项目,是一个纯 Java 桌面应用,用于压力测试和性能测试.它最初被设计用于 Web 应用测 ...

  5. JY播放器【蜻蜓FM电脑端,附带下载功能】

    今天给大家带来一款神器----JY播放器.可以不用打开网页就在电脑端听蜻蜓FM的节目,而且可以直接下载,对于我这种强迫症患者来说真的是神器.我是真的不喜欢电脑任务栏上面密密麻麻. 目前已经支持平台(蜻 ...

  6. .net mvc5 不同view()的视图 代码

    public class Test { public int id { set; get; } public string name { set; get; } } public ActionResu ...

  7. 5 种使用 Python 代码轻松实现数据可视化的方法

    数据可视化是数据科学家工作中的重要组成部分.在项目的早期阶段,你通常会进行探索性数据分析(Exploratory Data Analysis,EDA)以获取对数据的一些理解.创建可视化方法确实有助于使 ...

  8. 获取秒级时间戳和毫秒级时间戳---基于python

    获取秒级时间戳和毫秒级时间戳 import timeimport datetime t = time.time() print (t) #原始时间数据print (int(t)) #秒级时间戳prin ...

  9. win2008 r2 开启TLS1.2

    Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityPr ...

  10. 软工1816 · Alpha冲刺(5/10)

    团队信息 队名:爸爸饿了 组长博客:here 作业博客:here 组员情况 组员1(组长):王彬 过去两天完成了哪些任务 后端代码复审 福大各个食堂的菜品口味量化.属性标记 组织前后端线下协作 接下来 ...