# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
485462 |
2021-11-07T23:31:18 Z |
asij123 |
Poi (IOI09_poi) |
C++14 |
|
300 ms |
16100 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n; int t; int p;
struct Contestant{
int ID;
int numSolved=0; int score=0;
int problemSet[2000]= {0};
};
bool comp(Contestant one, Contestant two){
if(one.score== two.score){
if(one.numSolved==two.numSolved){
return one.ID > two.ID;
}
return one.numSolved< two.numSolved;
}
return one.score < two.score;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
cin >> n; cin >> t; cin >> p;
Contestant arr [n];
for(int i=1; i<= n; i++){
Contestant& con= arr[i-1];
con.ID= i;
for(int j=0; j<t; j++){
int ans; cin >>ans;
con.problemSet[j]= ans;
if(ans == 1){
con.numSolved++;
}
}
}
for(int i=0; i< t; i++){
int points=0;
for(Contestant& a: arr){
if(a.problemSet[i]==0) points++;
}
for(Contestant& a: arr){
if(a.problemSet[i]==1) a.score+=points;
}
}
sort(arr, arr+n, comp);
for(int i=0; i< n; i++){
if(arr[i].ID== p){
cout << arr[i].score << " " << (n-i);
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
332 KB |
Output is correct |
2 |
Correct |
0 ms |
332 KB |
Output is correct |
3 |
Correct |
0 ms |
332 KB |
Output is correct |
4 |
Correct |
0 ms |
332 KB |
Output is correct |
5 |
Correct |
1 ms |
460 KB |
Output is correct |
6 |
Correct |
1 ms |
716 KB |
Output is correct |
7 |
Correct |
1 ms |
844 KB |
Output is correct |
8 |
Correct |
1 ms |
844 KB |
Output is correct |
9 |
Correct |
2 ms |
1100 KB |
Output is correct |
10 |
Correct |
4 ms |
1888 KB |
Output is correct |
11 |
Correct |
10 ms |
2636 KB |
Output is correct |
12 |
Correct |
18 ms |
4172 KB |
Output is correct |
13 |
Correct |
46 ms |
5820 KB |
Output is correct |
14 |
Correct |
67 ms |
8260 KB |
Output is correct |
15 |
Correct |
116 ms |
9824 KB |
Output is correct |
16 |
Correct |
123 ms |
10616 KB |
Output is correct |
17 |
Correct |
182 ms |
12108 KB |
Output is correct |
18 |
Correct |
211 ms |
13756 KB |
Output is correct |
19 |
Correct |
289 ms |
16088 KB |
Output is correct |
20 |
Correct |
300 ms |
16100 KB |
Output is correct |