Submission #236158

#TimeUsernameProblemLanguageResultExecution timeMemory
236158nicolaalexandraPoi (IOI09_poi)C++14
100 / 100
858 ms24056 KiB
/// pb asta e mai penala decat mn #include <bits/stdc++.h> #define DIM 2010 using namespace std; struct idk{ int scor,cnt,poz; } w[DIM]; int v[DIM],a[DIM][DIM]; int n,t,p,i,j; inline int cmp (idk a, idk b){ if (a.scor == b.scor){ if (a.cnt == b.cnt) return a.poz < b.poz; return a.cnt > b.cnt; } return a.scor > b.scor; } int main (){ //ifstream cin ("date.in"); //ofstream cout ("date.out"); cin>>n>>t>>p; for (i=1;i<=n;i++){ for (j=1;j<=t;j++){ cin>>a[i][j]; if (!a[i][j]) v[j]++; } } for (i=1;i<=n;i++){ int sum = 0, cnt = 0; for (j=1;j<=t;j++) if (a[i][j]){ sum += v[j]; cnt++; } w[i] = {sum,cnt,i}; } sort (w+1,w+n+1,cmp); for (i=1;i<=n;i++) if (w[i].poz == p){ cout<<w[i].scor<<" "<<i; return 0; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...