# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
937871 | Muaath_5 | Poi (IOI09_poi) | C++17 | 182 ms | 16172 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>
#define ll long long
#define pll pair<ll, ll>
using namespace std;
const int N = 2009;
int n, t, p;
int solved[N][N];
int points[N];
struct contestant {
int id = 0;
int score = 0;
int count = 0;
friend bool operator<(contestant a, contestant b) {
if (a.score == b.score) {
if (a.count == b.count) {
return a.id > b.id;
}
return a.count < b.count;
}
return a.score < b.score;
}
} c[N];
int main()
{
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
cin >> n >> t >> p;
for (int i = 1; i <= n; i++) {
c[i].id = i;
for (int j = 1; j <= t; j++) {
cin >> solved[i][j];
if (solved[i][j])
c[i].count++, points[j]++;
}
}
for (int j = 1; j <= t; j++)
points[j] = n - points[j];
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= t; j++) {
if (solved[i][j])
c[i].score += points[j];
}
}
sort(c, c + n);
reverse(c, c + n);
for (int i = 1; i <= n; i++) {
if (c[i].id == p) {
cout << c[i].score << ' ' << i << '\n';
return 0;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |