# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
923352 |
2024-02-07T06:53:20 Z |
Zygno |
Poi (IOI09_poi) |
C++17 |
|
511 ms |
24408 KB |
#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> score;
vector<int> taskScore;
vector<tuple<int, int, int>> contestantScore;
int main(){
int n; // Number of contestants
int t; // Number of tasks
int p; // Philip’s ID was P
cin >> n >> t >> p;
//Read the task scores
for(int i = 0; i < n; i++){ // Contestant
score.push_back(std::vector<int>()); // Add a new row
for(int j = 0; j < t; j++){ // Task
int a;
cin >> a;
score[i].push_back(a); // Add an element to the first row
}
}
//Calculate the task scores
for(int j = 0; j < t; j++){ // Task
int points = 0;
for(int i = 0; i < n; i++){ // Contestant
if(score[i][j] == 0) points++;
}
taskScore.push_back(points);
}
//Calculate the contestant scores
for(int i = 0; i < n; i++){ // Contestant
int points = 0;
for(int j = 0; j < t; j++){ // Task
if(score[i][j] == 1){
points += taskScore[j];
}
}
tuple<int, int, int> temp = make_tuple(i, points, -1);
contestantScore.push_back(temp);
}
//Sort the contestant scores
sort(contestantScore.begin(), contestantScore.end(), [](const tuple<int, int, int> &a, const tuple<int, int, int> &b) {
return get<1>(a) > get<1>(b);
});
//Calculate the final standings
int currentRank = 1;
get<2>(contestantScore[0]) = currentRank;
for(int i = 1; i < n; i++){ // Contestant
if(get<1>(contestantScore[i]) < get<1>(contestantScore[i-1])){
currentRank = i+1;
}
get<2>(contestantScore[i]) = currentRank;
}
cout << get<1>(contestantScore[p-1]) << " " << get<2>(contestantScore[p-1]) << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
7 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
8 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
9 |
Incorrect |
2 ms |
344 KB |
Output isn't correct |
10 |
Incorrect |
4 ms |
600 KB |
Output isn't correct |
11 |
Incorrect |
17 ms |
1224 KB |
Output isn't correct |
12 |
Incorrect |
26 ms |
1628 KB |
Output isn't correct |
13 |
Incorrect |
76 ms |
4436 KB |
Output isn't correct |
14 |
Incorrect |
106 ms |
5952 KB |
Output isn't correct |
15 |
Incorrect |
198 ms |
13040 KB |
Output isn't correct |
16 |
Incorrect |
207 ms |
14340 KB |
Output isn't correct |
17 |
Incorrect |
296 ms |
17268 KB |
Output isn't correct |
18 |
Incorrect |
346 ms |
19388 KB |
Output isn't correct |
19 |
Incorrect |
453 ms |
23616 KB |
Output isn't correct |
20 |
Incorrect |
511 ms |
24408 KB |
Output isn't correct |