比赛 |
20160415 |
评测结果 |
AWWWWAWWWA |
题目名称 |
烤鸡翅 |
最终得分 |
30 |
用户昵称 |
dydxh |
运行时间 |
0.392 s |
代码语言 |
C++ |
内存使用 |
1.14 MiB |
提交时间 |
2016-04-15 11:48:03 |
显示代码纯文本
/*
Problem:Wing;
Language:c++;
by dydxh;
Date:2016.04.15;
*/
#include<algorithm>
#include<iostream>
#include<cstring>
#include<utility>
#include<cstdlib>
#include<cstdio>
#include<string>
#include<vector>
#include<ctime>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#define ll long long
#define ull unsigned long long
using namespace std;
const int oo=2000000000;
const int maxn=250005;
int n,Ans=0;
ll Sum;
int X[maxn];
inline int read(){
int x=0;bool flag=false;char ch=getchar();
while(ch>'9' || ch<'0'){if(ch=='-') flag=true;ch=getchar();}
while(ch>='0' && ch<='9'){x=x*10+ch-'0';ch=getchar();}
return flag?-x:x;
}
int main(){
freopen("wing.in","r",stdin);
freopen("wing.out","w",stdout);
n=read();
for(int i=1;i<=n;i++) Sum+=read();
for(int i=1;i<=n;i++) X[i]=read();
sort(X+1,X+1+n);
while(Ans<n && Sum>X[Ans+1]) Ans++,Sum-=X[Ans];
cout<<Ans<<endl;
//cout<<"Time has passed:"<<1.0*clock()/1000<<"s!"<<endl;
return 0;
}