Submission #569401

#TimeUsernameProblemLanguageResultExecution timeMemory
569401Aurora2005Poi (IOI09_poi)C++14
100 / 100
603 ms23812 KiB
#include<bits/stdc++.h> using namespace std; int main(){ int N,T,P; cin >> N >> T >> P; vector<vector<int>> solve(N,vector<int>(T)); for(int i=0;i<N;i++) for(int j=0;j<T;j++) cin >> solve[i][j]; vector<int> Wcnt(T,0); for(int i=0;i<N;i++) for(int j=0;j<T;j++) Wcnt[j] += 1-solve[i][j]; vector<int> Score(N,0),cnt(N,0); for(int i=0;i<N;i++){ for(int j=0;j<T;j++){ if(solve[i][j] == 1){ Score[i] += Wcnt[j]; cnt[i]++; } } } vector<pair<pair<int,int>,int>> Rank(N); for(int i=0;i<N;i++) Rank[i] = make_pair(make_pair(-Score[i],-cnt[i]),i+1); sort(Rank.begin(),Rank.end()); int ans; for(int i=0;i<N;i++) if(Rank[i].second == P) ans = i+1; cout << Score[P-1] << " " << ans << endl; }

Compilation message (stderr)

poi.cpp: In function 'int main()':
poi.cpp:25:32: warning: 'ans' may be used uninitialized in this function [-Wmaybe-uninitialized]
   25 |   cout << Score[P-1] << " " << ans << endl;
      |                                ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...