# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1248919 | feukic | Poi (IOI09_poi) | C11 | 0 ms | 0 KiB |
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int n, t, p;
cin >> n >> t >> p;
vector<int> points(t, 0);
vector<vector<int>> results(n, vector<int>(t, 0));
for (int i = 0; i < n; i++) {
for (int j = 0; j < t; j++) {
int x;
cin >> x;
points[j] += x == 0;
results[i][j] = x;
}
}
vector<vector<int>> ranking(n, vector<int> (3, 0));
for (int i = 0; i < n; i++) {
for (int j = 0; j < t; j++) {
ranking[i][0] += results[i][j] ? points[j] : 0;
ranking[i][1] += results[i][j];
ranking[i][2] = i + 1;
}
}
sort(ranking.begin(), ranking.end(), [](vector<int> a, vector<int> b) {
if (a[0] != b[0]) return a[0] > b[0];
if (a[0] == b[0] && a[1] != b[1]) return a[1] > b[1];
return a[2] < b[2];
});
for (int i = 0; i < n; i++) {
if (ranking[i][2] == p) {
cout << ranking[i][0] << " " << i + 1;
}
}
}