80分,第五个RE,求大佬指点

P1478 陶陶摘苹果(升级版)

winter_soldier @ 2018-07-26 10:54:49

include<bits/stdc++.h>

using namespace std; struct app{ int gao; int li; }a[60001],b[60001]; bool cmp(app x,app y) { if(x.li!=y.li) return x.li<y.li; } int main(){ int n,s,a1,b1,f=0,p=0; cin>>n>>s>>a1>>b1; for(int i=1;i<=n;i++) { cin>>a[i].gao>>a[i].li; if(a[i].gao<=a1+b1) { f++; b[f].gao=a[i].gao; b[f].li=a[i].li; } } sort(b+1,b+f+1,cmp); for(int i=1;i<=f;i++) { if(s>=b[i].li) { s-=b[i].li; p++; } } cout<<p; return 0; }


by henrytb @ 2018-07-26 10:56:29

Markdown大法吼


by meyi @ 2018-07-26 11:29:32


by Spider_Man_gjh @ 2018-07-26 14:12:22

第几题啊


by 发飙的蜗牛 @ 2018-07-26 16:24:22

@henrytb +1


by TERRYXU @ 2018-08-01 10:52:27

struct换了试试


|