记录编号 | 454733 | 评测结果 | AAAAAAAAAAAAAAAAAAAA | ||
---|---|---|---|---|---|
题目名称 | [NOIP 2016]蚯蚓 | 最终得分 | 100 | ||
用户昵称 | 是否通过 | 通过 | |||
代码语言 | C++ | 运行时间 | 2.565 s | ||
提交时间 | 2017-09-29 15:54:07 | 内存使用 | 1.08 MiB | ||
#include<iostream> #include<cstdio> #include<vector> #include<algorithm> #include<queue> using namespace std; const int inf=100000; const int maxn=100000+10; long long n,m,q,t,sum=0; double u,v,p; long long a[maxn]; queue<int>hh,ha,he; inline bool cmp(int a,int b) { return a>b; } inline int front(queue<int> &w) { if(w.empty())return -0x3f3f3f3f; else return w.front()+sum; } inline int max(int a,int b,int c) { if(a>=b&&a>=c)return a; else if(b>=a&&b>=c)return b; else if(c>=a&&c>=b)return c; else if(a==b==c)return a; } inline int qie() { long long MAX=max(front(hh),front(ha),front(he)); if(MAX==front(hh))hh.pop(); else if(MAX==front(ha))ha.pop(); else if(MAX==front(he))he.pop(); return MAX; } inline void read() { freopen("earthworm.in","r",stdin); freopen("earthworm.out","w",stdout); scanf("%lld%lld%lld%lld%lld%lld",&n,&m,&q,&u,&v,&t); for(int i=1;i<=n;i++) { scanf("%lld",&a[i]); } sort(a+1,a+1+n,cmp); for(int i=1;i<=n;i++)hh.push(a[i]); p=u/v; int x,y; for(int i=1;i<=m;i++) { int gg=qie(); int x=gg*p; int y=gg-x; ha.push(x-q-sum); he.push(y-q-sum); if(i%t==0)printf("%d ",gg); sum+=q; } printf("\n"); for(int i=1;i<=n+m;i++) { long long gg=qie(); if(i%t==0)printf("%lld ",gg); } } int main() { read(); return 0; }