# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
472807 |
2021-09-14T11:08:02 Z |
dron_rp |
Poi (IOI09_poi) |
C++14 |
|
342 ms |
24196 KB |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
struct Participant{
int id, tasks, points;
vector<int> scores;
};
void getScoreProblems(int n, int t, vector<int>& problems, vector<Participant>& participants){
int x;
for (int i = 0; i<n; i++){
participants[i].id = i+1;
int sum = 0;
for (int j = 0; j<t; j++){
cin >> x;
if (x == 0){
problems[j]++;
} else {
sum++;
}
participants[i].scores.push_back(x);
}
participants[i].tasks = sum;
participants[i].points = 0;
}
}
bool comp(Participant& a, Participant& b){
if (a.points != b.points){
return a.points >= b.points;
}
if (a.tasks != b.tasks){
return a.tasks >= b.tasks;
}
return a.id <= b.id;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, t, p;
cin >> n >> t >> p;
vector<int> problems(t, 0);
vector<Participant> participants(n);
getScoreProblems(n, t, problems, participants);
for (int i = 0; i<n; i++){
int sum = 0;
for (int j = 0; j<t; j++){
if (participants[i].scores[j] != 0) sum += problems[j];
}
participants[i].points = sum;
}
sort(participants.begin(), participants.end(), comp);
for (int i = 0; i<n; i++){
if (participants[i].id == p){
cout << participants[i].points << " " << i+1 << "\n";
break;
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
312 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
332 KB |
Output is correct |
8 |
Correct |
1 ms |
332 KB |
Output is correct |
9 |
Correct |
2 ms |
332 KB |
Output is correct |
10 |
Correct |
3 ms |
588 KB |
Output is correct |
11 |
Correct |
11 ms |
1120 KB |
Output is correct |
12 |
Correct |
19 ms |
1740 KB |
Output is correct |
13 |
Correct |
55 ms |
4264 KB |
Output is correct |
14 |
Correct |
75 ms |
5984 KB |
Output is correct |
15 |
Correct |
131 ms |
12848 KB |
Output is correct |
16 |
Correct |
142 ms |
13948 KB |
Output is correct |
17 |
Correct |
208 ms |
17092 KB |
Output is correct |
18 |
Correct |
238 ms |
19240 KB |
Output is correct |
19 |
Correct |
310 ms |
23448 KB |
Output is correct |
20 |
Correct |
342 ms |
24196 KB |
Output is correct |