Submission #474096

#TimeUsernameProblemLanguageResultExecution timeMemory
474096ValiAntoniePoi (IOI09_poi)C++14
100 / 100
771 ms15968 KiB
#include <bits/stdc++.h> using namespace std; struct elem{ int puncte,pr,indice; }total[2001]; bool cmp(elem A, elem B){ if(A.puncte == B.puncte){ if(A.pr == B.pr) return A.indice > B.indice; return A.pr < B.pr; } return A.puncte < B.puncte; } int n,t,p,a[2001][2001],i,j,suma,task[2001],nr,nr2; int main() { cin>>n>>t>>p; for(i=1;i<=n;i++){ for(j=1;j<=t;j++){ cin>>a[i][j]; } } for(i=1;i<=t;i++){ suma = 0; for(j=1;j<=n;j++){ if(!a[j][i]) suma++; } task[i] = suma; } for(i=1;i<=n;i++){ nr2 = 0; for(j=1;j<=t;j++){ if(a[i][j]){ nr2++; total[i].puncte += task[j]; } } total[i].pr = nr2; total[i].indice = i; } nr = total[p].puncte; cout << total[p].puncte << " "; sort(total+1,total+n+1,cmp); for(i=1;i<=n;i++){ if(total[i].indice == p){ cout << n - i + 1; break; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...