Submission #275322

#TimeUsernameProblemLanguageResultExecution timeMemory
275322Bill_00Poi (IOI09_poi)C++14
100 / 100
301 ms23928 KiB
#include <bits/stdc++.h> typedef long long ll; const ll inf=1000000000000000000; #define fr(i,c,d) for(ll i=c;i<=d;i++) #define MOD 1000000007 #define ff first #define ss second #define pb push_back #define mp make_pair #define pp push using namespace std; const int sz=173; string str(string x,int l,int r){ string h; for(int i=l;i<=r;i++){ h+=x[i]; } return h; } int a[2001][2001],b[2001]={0}; int main(){ //int color[200001]; ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n,t,p; cin >> n >> t >> p; for(int i=1;i<=n;i++){ for(int j=1;j<=t;j++){ cin >> a[i][j]; if(a[i][j]==0){ b[j]++; } } } vector<pair<pair<int,int>,int> >standings; for(int i=1;i<=n;i++){ int ans=0,solved=0; for(int j=1;j<=t;j++){ if(a[i][j]==1){ ans+=b[j]; solved++; } } standings.pb(mp(mp(ans,solved),-i)); } sort(standings.begin(),standings.end()); int len=standings.size(); for(int i=len-1;i>=0;i--){ if(standings[i].ss==-p){ cout << standings[i].ff.ff << ' ' << len-i; break; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...