Submission #963310

#TimeUsernameProblemLanguageResultExecution timeMemory
963310anangoPoi (IOI09_poi)C++17
100 / 100
520 ms32204 KiB
#include <bits/stdc++.h> #define int long long using namespace std; signed main() { int n,t,p; cin >> n >> t >> p; p--; vector<vector<int>> solves(t,vector<int>(n)); vector<int> points(t,n); for (int i=0; i<n; i++) { for (int j=0; j<t; j++) { int x; cin >> x; if (x==1) solves[j][i]++; if (x==1) points[j]--; } } vector<int> score(n,0); vector<int> tasks(n,0); for (int i=0; i<n; i++) { for (int j=0; j<t; j++) { if (solves[j][i])score[i]+=points[j]; if (solves[j][i])tasks[i]++; } //cout << score[i] <<" "; } vector<int> an; for (int i=0; i<n; i++) { an.push_back(i); } sort(an.begin(), an.end(), [=](const int x, const int y){ if (score[x]!=score[y]) { return score[x]>score[y]; } if (tasks[x]!=tasks[y]) { return tasks[x]>tasks[y]; } return x<y; }); int c=-1; for (int i=0; i<n; i++) { if (an[i]==p) { c=i+1; } } cout << score[p] << " " << c << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...