# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
531489 |
2022-02-28T21:44:44 Z |
sep |
Poi (IOI09_poi) |
C++14 |
|
575 ms |
16036 KB |
/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> points, solutionsPerProblem, problemsSolved;
bool comp(int i, int j) {
if (points[i] > points[j]) return true;
else if (points[i] < points[j]) return false;
else if (problemsSolved[i] > problemsSolved[j]) return true;
else if (problemsSolved[i] < problemsSolved[j]) return false;
return i < j;
}
void sortPlayers(vector<vector<int>> & table, vector<int> & players) {
int T = (int) table[0].size(), N = (int) players.size();
for (int i = 0; i < T; i++) {
for (int j = 0; j < N; j++) solutionsPerProblem[i] += table[j][i];
}
for (int i = 0; i < N; i++) {
for (int j = 0; j < T; j++) {
if (table[i][j]) {
points[i] += (N - solutionsPerProblem[j]);
problemsSolved[i]++;
}
}
}
sort(players.begin(), players.end(), comp);
}
int main()
{
int N, T, P;
cin >> N >> T >> P;
vector<vector<int>> table (N, vector<int>(T));
vector<int> players(N);
points.assign(N, 0);
problemsSolved.assign(N, 0);
solutionsPerProblem.assign(T, 0);
for (int i = 0; i < N; i++) {
players[i] = i;
for (int j = 0; j < T; j++) {
cin >> table[i][j];
}
}
sortPlayers(table, players);
for (int i = 0; i < N; i++) {
if (players[i] == P-1) {
cout << points[P-1] << " " << i + 1 << "\n";
break;
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
272 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
2 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
2 ms |
332 KB |
Output is correct |
10 |
Correct |
5 ms |
412 KB |
Output is correct |
11 |
Correct |
17 ms |
716 KB |
Output is correct |
12 |
Correct |
28 ms |
972 KB |
Output is correct |
13 |
Correct |
83 ms |
2636 KB |
Output is correct |
14 |
Correct |
131 ms |
3636 KB |
Output is correct |
15 |
Correct |
236 ms |
6092 KB |
Output is correct |
16 |
Correct |
216 ms |
6604 KB |
Output is correct |
17 |
Correct |
381 ms |
9796 KB |
Output is correct |
18 |
Correct |
375 ms |
10956 KB |
Output is correct |
19 |
Correct |
546 ms |
14464 KB |
Output is correct |
20 |
Correct |
575 ms |
16036 KB |
Output is correct |