# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
377132 | kevinxiehk | Poi (IOI09_poi) | C++17 | 772 ms | 12416 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
struct con{
bool solve[2005];
int score=0;
int cnt=0;
int id=0;
}ppl[2005];
bool cmp(con a,con b){
if(a.score==b.score){
if(a.cnt==b.cnt)return a.id<b.id;
return a.cnt>b.cnt;
}
return a.score>b.score;
}
int cannot[2005];
int main(){
int n,t,p;
cin>>n>>t>>p;
for(int i=0;i<2000;i++)cannot[i]=0;
for(int i=1;i<=n;i++){
ppl[i].id=i;
for(int j=0;j<t;j++){
cin>>ppl[i].solve[j];
cannot[j]+=(1-ppl[i].solve[j]);
if(ppl[i].solve[j])ppl[i].cnt++;
}
}
for(int i=1;i<=n;i++){
for(int j=0;j<t;j++){
ppl[i].score+=ppl[i].solve[j]*cannot[j];
}
}
sort(ppl+1,ppl+n+1,cmp);
int rank=1;
while(ppl[rank].id!=p)rank++;
cout<<ppl[rank].score<<" "<<rank<<endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |