# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
751426 |
2023-05-31T14:40:22 Z |
vjudge1 |
Poi (IOI09_poi) |
C++17 |
|
245 ms |
23756 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first
#define se second
bool cmp(pair <pair <ll, ll>, ll> a, pair <pair <ll, ll>, ll> b){
if(a.fi.fi == b.fi.fi){
if(a.fi.se == b.fi.se) return a.se < b.se;
else return a.fi.se > b.fi.se;
}
else return a.fi.fi > b.fi.fi;
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, m, p;
cin >> n >> m >> p;
p--; // 0-th based
// pair {score, task solve, id}
int arr[n][m];
for(int a = 0; a < n; ++a){
for(int b = 0; b < m; ++b){
cin >> arr[a][b];
}
}
// calculate task score
ll score[m];
memset(score, 0, sizeof score);
for(int a = 0; a < n; ++a){
for(int b = 0; b < m; ++b){
if(!arr[a][b]) score[b]++;
}
}
pair <pair <ll, ll>, ll> contestants[n];
for(int a = 0; a < n; ++a){
contestants[a].se = a;
contestants[a].fi.fi = 0;
contestants[a].fi.se = 0;
for(int b = 0; b < m; ++b){
if(arr[a][b]){
contestants[a].fi.fi += score[b];
contestants[a].fi.se++;
}
}
}
sort(contestants, contestants + n, cmp);
for(int a = 0; a < n; ++a){
if(contestants[a].se == p){
cout << contestants[a].fi.fi << " " << a + 1 << '\n';
break;
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
328 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
2 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
2 ms |
468 KB |
Output is correct |
11 |
Correct |
8 ms |
976 KB |
Output is correct |
12 |
Correct |
13 ms |
1488 KB |
Output is correct |
13 |
Correct |
35 ms |
3788 KB |
Output is correct |
14 |
Correct |
52 ms |
5280 KB |
Output is correct |
15 |
Correct |
96 ms |
9100 KB |
Output is correct |
16 |
Correct |
99 ms |
9848 KB |
Output is correct |
17 |
Correct |
197 ms |
14404 KB |
Output is correct |
18 |
Correct |
160 ms |
16320 KB |
Output is correct |
19 |
Correct |
220 ms |
21428 KB |
Output is correct |
20 |
Correct |
245 ms |
23756 KB |
Output is correct |