Submission #906082

#TimeUsernameProblemLanguageResultExecution timeMemory
906082JCCPoi (IOI09_poi)C++14
100 / 100
242 ms24288 KiB
#include<algorithm> #include<iostream> #include<vector> #include<map> using namespace std; vector<int> points,one; bool comp(int i, int j) { if (points[i] > points[j]) { return true; } else if (points[i] < points[j]) { return false; } else if (one[i] > one[j]) { return true; } else if (one[i] < one[j]) { return false; } return i < j; } int main() { ios::sync_with_stdio(false); cin.tie(NULL); int n,t,p,x; cin >> n >> t >> p; vector<vector<int>> k(n); vector<int> player; for(int i = 0; i < n; i++) { player.push_back(i); for (int j = 0;j < t; j++) { cin >> x; k[i].push_back(x); } } vector<int> scores; for(int j = 0; j < t; j++) { int total = 0; for (int i = 0;i < n; i++) { if (k[i][j] == 0) total++; } scores.push_back(total); } for (int i=0;i<n;i++) { int point = 0; int done = 0; for (int j=0;j < t;j++) { if (k[i][j] == 1) { point+=scores[j]; done++; } } points.push_back(point); one.push_back(done); } sort(player.begin(), player.end(), comp); for (int i=0;i < n; i++) { if (player[i] == p-1) { cout << points[p-1] << " " << i+1 << "\n"; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...