# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
696553 |
2023-02-06T19:29:44 Z |
Hacv16 |
Poi (IOI09_poi) |
C++17 |
|
221 ms |
57280 KB |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAX = 2e6 + 15;
const int INF = 0x3f3f3f3f;
int n, t, p, value[MAX], score[MAX];
vector<int> solve[MAX];
bool cmp(int a, int b){
if(score[a] != score[b]) return score[a] > score[b];
if(solve[a].size() != solve[b].size()) return solve[a].size() > solve[b].size();
return a < b;
}
int32_t main(void){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> n >> t >> p;
for(int i = 1; i <= t; i++) value[i] = n;
for(int i = 1; i <= n; i++){
for(int k = 1; k <= t; k++){
ll x; cin >> x;
if(x){ value[k]--; solve[i].push_back(k); }
}
}
for(int i = 1; i <= n; i++)
for(auto x : solve[i])
score[i] += value[x];
vector<int> rank(n);
iota(rank.begin(), rank.end(), 1);
sort(rank.begin(), rank.end(), cmp);
for(int i = 0; i < rank.size(); i++)
if(rank[i] == p){ cout << score[p] << ' ' << i + 1 << '\n'; exit(0); }
}
Compilation message
poi.cpp: In function 'int32_t main()':
poi.cpp:41:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
41 | for(int i = 0; i < rank.size(); i++)
| ~~^~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
29 ms |
47188 KB |
Output is correct |
2 |
Correct |
29 ms |
47252 KB |
Output is correct |
3 |
Correct |
25 ms |
47188 KB |
Output is correct |
4 |
Correct |
24 ms |
47284 KB |
Output is correct |
5 |
Correct |
25 ms |
47188 KB |
Output is correct |
6 |
Correct |
27 ms |
47308 KB |
Output is correct |
7 |
Correct |
28 ms |
47244 KB |
Output is correct |
8 |
Correct |
27 ms |
47316 KB |
Output is correct |
9 |
Correct |
25 ms |
47328 KB |
Output is correct |
10 |
Correct |
25 ms |
47436 KB |
Output is correct |
11 |
Correct |
30 ms |
47756 KB |
Output is correct |
12 |
Correct |
36 ms |
48104 KB |
Output is correct |
13 |
Correct |
53 ms |
49864 KB |
Output is correct |
14 |
Correct |
67 ms |
50664 KB |
Output is correct |
15 |
Correct |
98 ms |
53192 KB |
Output is correct |
16 |
Correct |
104 ms |
53536 KB |
Output is correct |
17 |
Correct |
142 ms |
54156 KB |
Output is correct |
18 |
Correct |
153 ms |
54948 KB |
Output is correct |
19 |
Correct |
194 ms |
56176 KB |
Output is correct |
20 |
Correct |
221 ms |
57280 KB |
Output is correct |