# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
761777 | Blagoj | Poi (IOI09_poi) | C++17 | 211 ms | 23756 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;
#define endl '\n'
#define ll long long
#define all(x) x.begin(), x.end()
struct T {
int score, tasks, id;
};
bool csort(T a, T b) {
if (a.score != b.score) return a.score > b.score;
if (a.tasks != b.tasks) return a.tasks > b.tasks;
return a.id < b.id;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, t, p;
cin >> n >> t >> p;
--p;
int val[t], solve[n][t];
memset(val, 0, sizeof(val));
for (int i = 0; i < n; i++) {
for (int j = 0; j < t; j++) {
cin >> solve[i][j];
val[j] += (solve[i][j] == 0);
}
}
vector<T> v;
for (int i = 0; i < n; i++) {
int sum = 0, tasks = 0;
for (int j = 0; j < t; j++) {
if (solve[i][j] == 1) {
tasks++;
sum += val[j];
}
}
v.push_back({sum, tasks, i});
}
sort(all(v), csort);
for (int i = 0; i < n; i++) {
if (v[i].id == p) {
cout << v[i].score << " " << i + 1;
return 0;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |