# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
741771 |
2023-05-14T21:00:20 Z |
MODDI |
Poi (IOI09_poi) |
C++14 |
|
611 ms |
15972 KB |
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<long long, long long> pll;
typedef pair<int,int> pii;
typedef vector<long long> vl;
typedef vector<int> vi;
int n, t, k;
int mat[2001][2001];
struct state{
int points;
int cnt_solved;
int id;
};
bool comp(state& a, state& b){
if(a.points == b.points){
if(a.cnt_solved == b.cnt_solved)
return a.id < b.id;
else{
return a.cnt_solved > b.cnt_solved;
}
}
else
return a.points > b.points;
}
int main(){
cin>>n>>t>>k;
k--;
for(int i = 0; i < n; i++)
for(int j = 0; j < t; j++)
cin>>mat[i][j];
int points[t];
memset(points, 0, sizeof points);
for(int j = 0; j < t; j++){
for(int i = 0; i < n; i++){
if(mat[i][j] == 0)
points[j]++;
}
}
vector<state> arr;
for(int i = 0; i < n; i++){
int cnt = 0, pts = 0;
for(int j = 0; j < t; j++){
if(mat[i][j] == 1){
cnt++;
pts += points[j];
}
else
continue;
}
state now;
now.cnt_solved = cnt;
now.points = pts;
now.id = i;
arr.pb(now);
}
sort(arr.begin(), arr.end(), comp);
for(int i = 0; i < n; i++){
if(arr[i].id == k){
cout<<arr[i].points<<" "<<i+1<<endl;
return 0;
}
}
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 |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
468 KB |
Output is correct |
7 |
Correct |
1 ms |
596 KB |
Output is correct |
8 |
Correct |
1 ms |
596 KB |
Output is correct |
9 |
Correct |
3 ms |
724 KB |
Output is correct |
10 |
Correct |
6 ms |
1164 KB |
Output is correct |
11 |
Correct |
21 ms |
1904 KB |
Output is correct |
12 |
Correct |
30 ms |
3024 KB |
Output is correct |
13 |
Correct |
107 ms |
5408 KB |
Output is correct |
14 |
Correct |
129 ms |
7572 KB |
Output is correct |
15 |
Correct |
236 ms |
9656 KB |
Output is correct |
16 |
Correct |
236 ms |
10504 KB |
Output is correct |
17 |
Correct |
355 ms |
12120 KB |
Output is correct |
18 |
Correct |
398 ms |
13564 KB |
Output is correct |
19 |
Correct |
523 ms |
15972 KB |
Output is correct |
20 |
Correct |
611 ms |
15948 KB |
Output is correct |