# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
277082 |
2020-08-21T02:50:34 Z |
ec1117 |
Poi (IOI09_poi) |
C++17 |
|
1125 ms |
9780 KB |
#include "bits/stdc++.h";
using namespace std;
#define pb push_back
#define mp make_pair
int n, t, p;
int main() {
cin >> n >> t >> p;
p--;
int taskSolved[t];
vector<int> pSolved[n];
int pscore[n];
for(int i=0;i<t;i++)
taskSolved[i]=0;
for(int i=0;i<n;i++)
pscore[i]=0;
for (int i = 0; i < n; i++) {
for (int j = 0; j < t; j++) {
int x;
cin >> x;
if (x == 1) {
taskSolved[j]++;
pSolved[i].push_back(j);
}
}
}
for (int i = 0; i < t; i++) {
taskSolved[i] = n - taskSolved[i];
}
vector<pair<pair<int,int>,int> >standings;
for(int i=0;i<n;i++){
for(int j:pSolved[i]){
pscore[i]+=taskSolved[j];
}
standings.pb(mp(mp(pscore[i],pSolved[i].size()),-i));
}
sort(standings.begin(),standings.end());
int rank=0, score=0;
for(int i=n-1;i>=0;i--){
if(standings[i].second==-p){
rank=n-i;
score=standings[i].first.first;
break;
}
}
cout << score << ' '<<rank;
return 0;
}
/*
* need to sort by custom comparator:
* need to know score, tasks solved, id
*/
Compilation message
poi.cpp:1:25: warning: extra tokens at end of #include directive
1 | #include "bits/stdc++.h";
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
0 ms |
256 KB |
Output is correct |
4 |
Correct |
0 ms |
256 KB |
Output is correct |
5 |
Correct |
1 ms |
256 KB |
Output is correct |
6 |
Correct |
1 ms |
256 KB |
Output is correct |
7 |
Correct |
2 ms |
384 KB |
Output is correct |
8 |
Correct |
2 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
9 ms |
384 KB |
Output is correct |
11 |
Correct |
33 ms |
632 KB |
Output is correct |
12 |
Correct |
54 ms |
888 KB |
Output is correct |
13 |
Correct |
159 ms |
1820 KB |
Output is correct |
14 |
Correct |
235 ms |
2424 KB |
Output is correct |
15 |
Correct |
418 ms |
5280 KB |
Output is correct |
16 |
Correct |
445 ms |
5624 KB |
Output is correct |
17 |
Correct |
702 ms |
6648 KB |
Output is correct |
18 |
Correct |
748 ms |
7396 KB |
Output is correct |
19 |
Correct |
977 ms |
8440 KB |
Output is correct |
20 |
Correct |
1125 ms |
9780 KB |
Output is correct |