Submission #522266

#TimeUsernameProblemLanguageResultExecution timeMemory
522266new_accPoi (IOI09_poi)C++14
100 / 100
223 ms28156 KiB
#include<bits/stdc++.h> #define fi first #define se second #define rep(a, b) for(int a = 0; a < (int)(b); a++) using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; const int N=5e5+10; pair<int,int>t[N]; int ile[N],zr[N]; vi xd[N]; void solve(){ int n,m,p; cin>>n>>m>>p; p--; rep(i,n){ rep(j,m){ int a; cin>>a; ile[j]+=!a; xd[i].push_back(a); } } rep(i,n){ rep(j,m) if(xd[i][j]==1) t[i].fi+=ile[j],zr[i]++; t[i].se=i; } sort(t,t+n,[](pair<int,int> a,pair<int,int> b){ if(a.fi==b.fi){ if(zr[a.se]==zr[b.se]) return a.se<b.se; return zr[a.se]>zr[b.se]; } return a.fi>b.fi; }); rep(i,n) if(t[i].se==p) cout<<t[i].fi<<" "<<i+1<<"\n"; } int main(){ ios_base::sync_with_stdio(0),cin.tie(0); solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...