Submission #439263

#TimeUsernameProblemLanguageResultExecution timeMemory
439263luka1234Poi (IOI09_poi)C++14
0 / 100
758 ms23896 KiB
#include <bits/stdc++.h> #define ll long long #define ff first #define ss second using namespace std; int task[2001]; int cont[2001][2001]; pair<int,pair<int,int> > a[2001]; bool comp(pair<int,pair<int,int> > a,pair<int,pair<int,int> > b){ if(a.ff<b.ff) return 1; else{ if(a.ff==b.ff){ if(a.ss.ff<b.ss.ff) return 1; else{ if(a.ss.ff==b.ss.ff){ if(a.ss.ss<b.ss.ss) return 1; else return 0; } else return 0; } } else return 0; } } int main(){ int n,m,p; cin>>n>>m>>p; for(int k=1;k<=n;k++){ for(int i=1;i<=m;i++){ cin>>cont[k][i]; if(cont[k][i]==0) task[i]++; } } for(int k=1;k<=n;k++){ for(int i=1;i<=m;i++){ if(cont[k][i]==1){ a[k].ff+=task[i]; a[k].ss.ff++; } } a[k].ss.ss=k; } sort(a+1,a+n+1,comp); for(int k=1;k<=n;k++){ if(a[k].ss.ss==p){ cout<<a[k].ff<<' '<<k; //return 0; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...