# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
349589 |
2021-01-17T21:53:04 Z |
Farrius |
Poi (IOI09_poi) |
C++11 |
|
676 ms |
23916 KB |
#include <bits/stdc++.h>
using namespace std;
const int MX = 2e3 + 5;
int points[MX], pp[MX];
bool cmp (const pair<int, pair<int, int>>& a, const pair<int, pair<int, int>>& b) {
if (a.first == b.first) {
if (a.second.first == b.second.first) return a.second.second < b.second.second;
else return a.second.first > b.second.first;
} else {
return a.first > b.first;
}
}
int main () {
int n, t, p;
cin >> n >> t >> p;
vector<pair<int, pair<int, int>>> score;
vector<vector<int>> ar(n, vector<int>(t));
for (int i = 0; i < n; i++) {
for (int j = 0; j < t; j++) {
cin >> ar[i][j];
if (ar[i][j] == 1) points[j]++;
}
}
for (int i = 0; i < n; i++) {
int cur = 0, prob = 0;
for (int j = 0; j < t; j++) {
if (ar[i][j] == 1) {
prob++;
cur += n - points[j];
}
}
score.push_back(make_pair(cur, make_pair(prob, i)));
}
sort(score.begin(), score.end(), cmp);
p--;
for (int i = 0; i < n; i++) {
if (score[i].second.second == p) {
cout << score[i].first << ' ' << i + 1 << '\n';
break;
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
364 KB |
Output is correct |
7 |
Correct |
1 ms |
364 KB |
Output is correct |
8 |
Correct |
2 ms |
364 KB |
Output is correct |
9 |
Correct |
3 ms |
364 KB |
Output is correct |
10 |
Correct |
6 ms |
512 KB |
Output is correct |
11 |
Correct |
21 ms |
1016 KB |
Output is correct |
12 |
Correct |
34 ms |
1516 KB |
Output is correct |
13 |
Correct |
101 ms |
3820 KB |
Output is correct |
14 |
Correct |
143 ms |
5356 KB |
Output is correct |
15 |
Correct |
259 ms |
9196 KB |
Output is correct |
16 |
Correct |
275 ms |
10092 KB |
Output is correct |
17 |
Correct |
405 ms |
14444 KB |
Output is correct |
18 |
Correct |
458 ms |
16364 KB |
Output is correct |
19 |
Correct |
604 ms |
21612 KB |
Output is correct |
20 |
Correct |
676 ms |
23916 KB |
Output is correct |