# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
930381 | vjudge1 | Poi (IOI09_poi) | C++17 | 250 ms | 23888 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<cstdio>
#include<algorithm>
#define UP(i,a,b) for(i=a;i<=(b);++i)
#define DN(i,a,b) for(i=a;i>=(b);--i)
using std::sort;
const int N=2e3+5;
int a[N][N],score[N],n,t,p;
struct node{
int sc,cnt,i;
node():sc(0),cnt(0){}
}b[N];
bool operator<(node a,node b){
if(a.sc!=b.sc){
return a.sc>b.sc;
}else if(a.cnt!=b.cnt){
return a.cnt>b.cnt;
}else{
return a.i<b.i;
}
}
int main(){
int i,j;
scanf("%d%d%d",&n,&t,&p);
UP(i,1,n){
UP(j,1,t){
scanf("%d",&a[i][j]);
score[j]+=!a[i][j];
b[i].cnt+=a[i][j];
}
b[i].i=i;
}
UP(i,1,n){
UP(j,1,t){
b[i].sc+=a[i][j]*score[j];
}
}
sort(b+1,b+n+1);
UP(i,1,n){
if(b[i].i==p){
printf("%d %d\n",b[i].sc,i);
break;
}
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |