# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
440178 | dxz05 | Poi (IOI09_poi) | C++14 | 888 ms | 8496 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2022;
bool sol[MAXN][MAXN];
int cnt[MAXN];
pair<pair<int, int>, int> a[MAXN];
int points[MAXN], solved[MAXN];
int main(){
int N, M, P;
cin >> N >> M >> P;
fill(cnt, cnt + M, N);
for (int i = 0; i < N; i++){
for (int j = 0; j < M; j++){
cin >> sol[i][j];
cnt[j] -= sol[i][j];
}
}
vector<int> v(N);
for (int i = 0; i < N; i++){
v[i] = i;
for (int j = 0; j < M; j++){
if (sol[i][j]){
points[i] += cnt[j];
solved[i]++;
}
}
}
sort(v.begin(), v.end(), [](int i, int j){
if (points[i] > points[j]) return true;
if (solved[i] > solved[j]) return true;
return i < j;
});
for (int i = 0; i < N; i++){
int j = v[i];
if (j + 1 == P){
cout << points[j] << ' ' << j + 1 << endl;
return 0;
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |