#include <bits/stdc++.h>
using namespace std;
signed main() {
int n,t,p; cin>>n>>t>>p;
vector<int>v(t,n);
vector<vector<bool>>l(n,vector<bool>(t));
for(int i = 0 ; i < n ; i++) {
for(int j = 0 ; j < t ; j++) {
int x; cin>>x;
if(x) l[i][j] = 1;
if(l[i][j]) v[j]--;
}
}
vector<pair<int,int>>scores;
for(int i = 0 ; i < n ; i++) {
int score = 0;
for(int j = 0 ; j < t ; j++) {
if(l[i][j]) score += v[j];
}
scores.push_back({score,i});
}
p--;
sort(scores.begin(),scores.end());
for(int i = 0 ; i < n ; i++) {
if(scores[i].second == p) {
cout << scores[i].first << " " << ++i;
return 0;
}
}
assert(0);
}
Compilation message
poi.cpp: In function 'int main()':
poi.cpp:27:47: warning: operation on 'i' may be undefined [-Wsequence-point]
27 | cout << scores[i].first << " " << ++i;
| ^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
208 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
296 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
208 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
208 KB |
Output isn't correct |
6 |
Incorrect |
1 ms |
208 KB |
Output isn't correct |
7 |
Correct |
1 ms |
208 KB |
Output is correct |
8 |
Incorrect |
2 ms |
304 KB |
Output isn't correct |
9 |
Incorrect |
2 ms |
336 KB |
Output isn't correct |
10 |
Incorrect |
5 ms |
368 KB |
Output isn't correct |
11 |
Incorrect |
17 ms |
560 KB |
Output isn't correct |
12 |
Incorrect |
28 ms |
688 KB |
Output isn't correct |
13 |
Incorrect |
85 ms |
1524 KB |
Output isn't correct |
14 |
Incorrect |
116 ms |
2088 KB |
Output isn't correct |
15 |
Incorrect |
209 ms |
3468 KB |
Output isn't correct |
16 |
Incorrect |
244 ms |
3744 KB |
Output isn't correct |
17 |
Incorrect |
337 ms |
5368 KB |
Output isn't correct |
18 |
Incorrect |
414 ms |
6016 KB |
Output isn't correct |
19 |
Incorrect |
514 ms |
7888 KB |
Output isn't correct |
20 |
Incorrect |
554 ms |
8696 KB |
Output isn't correct |