#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pb push_back
#define ll long long
using namespace std;
bool a[2001][2001];
int tasks[2001];
pair<int , int > score [2001];
vector<int > hel;
int main (){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n , t, p;
cin >> n >> t >> p;
memset(score , 0 , sizeof(score));
for(int i = 1; i<=n; i++){
for(int j = 1; j<=t; j++){
cin >> a[i][j];
if(a[i][j] == 0){
tasks[j]++;
}
}
}
for(int i = 1; i<=n; i++){
score[i].ss = i;
for(int j = 1; j<=t; j++){
if(a[i][j] == 1 ){
score[i].ff+=tasks[j];
}
}
}
int pl = score[p].ff;
sort(score +1 , score + n + 1);
for(int i = n; i>=1; i--){
if(score[i].ff == pl){
hel.pb(score[i].ss);
}
}
sort(hel.begin(), hel.end());
int rat =0;
for(int i = 0; i<hel.size(); i++){
if(hel[i] == p){
rat = i;
break;
}
}
for(int i = n; i>=1; i--){
if(score[i - 1].ff == pl){
cout << pl << " " << n - i + 2 + rat << endl;
return 0;
}
}
}
Compilation message
poi.cpp: In function 'int main()':
poi.cpp:49:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
49 | for(int i = 0; i<hel.size(); i++){
| ~^~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
384 KB |
Output isn't correct |
4 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
512 KB |
Output is correct |
7 |
Incorrect |
1 ms |
640 KB |
Output isn't correct |
8 |
Incorrect |
1 ms |
512 KB |
Output isn't correct |
9 |
Correct |
2 ms |
640 KB |
Output is correct |
10 |
Correct |
3 ms |
768 KB |
Output is correct |
11 |
Correct |
11 ms |
1280 KB |
Output is correct |
12 |
Correct |
18 ms |
1664 KB |
Output is correct |
13 |
Incorrect |
53 ms |
2936 KB |
Output isn't correct |
14 |
Correct |
77 ms |
3768 KB |
Output is correct |
15 |
Incorrect |
134 ms |
3960 KB |
Output isn't correct |
16 |
Correct |
161 ms |
4120 KB |
Output is correct |
17 |
Correct |
210 ms |
4248 KB |
Output is correct |
18 |
Correct |
240 ms |
4472 KB |
Output is correct |
19 |
Correct |
319 ms |
5112 KB |
Output is correct |
20 |
Correct |
348 ms |
4984 KB |
Output is correct |