比赛 |
20160415 |
评测结果 |
AWWWWAWWWA |
题目名称 |
烤鸡翅 |
最终得分 |
30 |
用户昵称 |
debug |
运行时间 |
0.317 s |
代码语言 |
C++ |
内存使用 |
5.04 MiB |
提交时间 |
2016-04-15 08:44:01 |
显示代码纯文本
- #include<cstdio>
- #include<algorithm>
- long long f[311111]={};long long g[311111]={};int tou,wei,n,ans=0;long long temp=0;
- int main()
- {
- freopen("wing.in","r",stdin);
- freopen("wing.out","w",stdout);
- scanf("%d",&n);
- for(int i=1;i<=n;i++)scanf("%lld",&f[i]);
- for(int i=1;i<=n;i++)scanf("%lld",&g[i]);
- std::sort(g+1,g+n+1);tou=1,wei=n;
- for(int i=1;i<=n;i++){
- temp+=f[i];
- if(temp>=g[tou]) temp-=g[tou],tou++,ans++;
- else wei--;
- }
- printf("%d\n",ans);
- return 0;
- }