# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
440186 | dxz05 | Poi (IOI09_poi) | C++14 | 838 ms | 4404 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;
for (int i = 1; i <= N; i++){
for (int j = 1; j <= M; j++){
cin >> sol[i][j];
cnt[j] += sol[i][j];
}
}
vector<int> v(N);
for (int i = 1; i <= N; i++){
v[i - 1] = i;
for (int j = 1; j <= M; j++){
if (sol[i][j]){
points[i] += N - cnt[j];
solved[i]++;
}
}
// cout << points[i] << ' ' << solved[i] << endl;
}
sort(v.begin(), v.end(), [](int i, int j){
if (points[i] > points[j]) return true;
if (points[i] == points[j] && solved[i] > solved[j]) return true;
if (points[i] == points[j] && solved[i] == solved[j]) return i < j;
return false;
});
cout << points[P] << ' ';
for (int i = 0; i < N; i++){
if (v[i] == P){
cout << i + 1 << endl;
return 0;
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |