Submission #978957

#TimeUsernameProblemLanguageResultExecution timeMemory
978957tamir1Poi (IOI09_poi)C++17
100 / 100
220 ms12148 KiB
#include<bits/stdc++.h> #define ll long long using namespace std; struct ct{ ll pt,sd,id; }; ct x[2005]; ll n,t,me,i,j,p[2005]; bool a[2005][2005]; bool cmp(ct a,ct b){ if(a.pt==b.pt && a.sd==b.sd) return a.id<b.id; if(a.pt==b.pt) return a.sd>b.sd; return a.pt>b.pt; } int main(){ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin >> n >> t >> me; for(i=1;i<=n;i++) for(j=1;j<=t;j++){ cin >> a[i][j]; if(!a[i][j]) p[j]++; } for(i=1;i<=n;i++){ x[i].id=i; for(j=1;j<=t;j++){ if(a[i][j]){ x[i].sd++; x[i].pt+=p[j]; } } } sort(x+1,x+n+1,cmp); for(i=1;i<=n;i++){ if(x[i].id==me){ cout << x[i].pt << " " << i; return 0; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...