Submission #495537

#TimeUsernameProblemLanguageResultExecution timeMemory
495537PiejanVDCPoi (IOI09_poi)C++17
70 / 100
553 ms884 KiB
#include <bits/stdc++.h> using namespace std; signed main() { int n,t,p; cin>>n>>t>>p; vector<int>v(t,n); vector<vector<bool>>l(n,vector<bool>(t,0)); for(int i = 0 ; i < n ; i++) { for(int j = 0 ; j < t ; j++) { int x; cin>>x; if(x) l[i][j] = 1; if(l[i][j]) v[j]--; } } vector<pair<int,int>>scores; for(int i = 0 ; i < n ; i++) { int score = 0; for(int j = 0 ; j < t ; j++) { if(l[i][j]) score += v[j]; } scores.push_back({score,i}); } p--; sort(scores.rbegin(),scores.rend()); for(int i = 0 ; i < n ; i++) { if(scores[i].second == p) { int j = i+1; int cnt=0; while(j < n && scores[j].first == scores[i].first) cnt++,j++; j = i-1; int cntB=0; while(j >= 0 && scores[j].first == scores[i].first) cntB++,j--; cout << scores[i].first << " " << i - cntB + cnt + 1; return 0; } } assert(0); }
#Verdict Execution timeMemoryGrader output
Fetching results...