测试点2AC,其他全WA

P1068 [NOIP2009 普及组] 分数线划定

~~数组不从1开始不看~~
by liao @ 2019-02-01 14:30:48


@[liao](/space/show?uid=106791) **凭什么**
by juruojjl_ @ 2019-02-01 14:35:25


忒 难看了 要改掉啊
by liao @ 2019-02-01 14:48:17


我也没有过啊 80分 我再试试 ```cpp // luogu-judger-enable-o2 #include<bits/stdc++.h> using namespace std; struct cpt { short k,s; }; bool cmp(struct cpt a,struct cpt b) { if(a.s!=b.s) return a.s>b.s; else return a.k<b.k; } int main() { int n,m,i; cin>>n>>m; cpt ctr[n]; for(i=0; i<n; i++) cin>>ctr[i].k>>ctr[i].s; sort(ctr,ctr+n,cmp); int sum=ctr[(int)(floor(m*1.5))].s; int num=(int)(floor(m*1.5)); cout<<sum<<' '; int s=0; i=0; for(int i=0; i<n; i++) if(ctr[i].s>=sum) s++; cout<<s<<endl; for(int i=0; i<n; i++) if(ctr[i].s>=sum) cout<<ctr[i].k<<' '<<ctr[i].s<<endl; else break; return 0; } ```
by liao @ 2019-02-01 14:49:30


以前的代码~~丢脸~~从0开始的
by liao @ 2019-02-01 14:50:32


@[吉家麟](/space/show?uid=164836) ```cpp #include<bits/stdc++.h> using namespace std; struct person { int pos,scr; } arr[50001],ans[50001]; bool compare(person a,person b) { if(a.scr!=b.scr) return a.scr>b.scr; else return a.pos<b.pos; } int n,m; int main() { cin>>n>>m; for(int i=1; i<=n; i++) cin>>arr[i].pos>>arr[i].scr; sort(arr+1,arr+1+n,compare); int s1=0,s2=arr[int(m*1.5)].scr; for(int i=1; i<=n; i++) if(arr[i].scr>=s2) ans[++s1].pos=arr[i].pos,ans[s1].scr=arr[i].scr; cout<<s2<<' '<<s1<<endl; for(int i=1; i<=s1; i++) cout<<ans[i].pos<<' '<<ans[i].scr<<endl; return 0; } ```
by liao @ 2019-02-01 15:04:36


这才是我的码风
by liao @ 2019-02-01 15:05:22


在吗@[吉家麟](/space/show?uid=164836)
by liao @ 2019-02-01 15:11:37


...
by juruojjl_ @ 2019-02-01 15:12:03


。。。
by liao @ 2019-02-01 15:14:23


| 下一页