# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|
1194149 | | SulA | Poi (IOI09_poi) | C++20 | | 163 ms | 16160 KiB |
#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
#define popcount(x) __builtin_popcountll(x)
using namespace std;
using namespace chrono;
int score[2000], tasks[2000];
void solve() {
int n,t,p; cin >> n >> t >> p;
int a[n][t];
for (int i = 0; i < n; i++) for (int j = 0; j < t; cin >> a[i][j++]);
for (int task = 0; task < t; task++) {
long long get = 0;
for (int i = 0; i < n; i++)
get += a[i][task] == 0;
for (int i = 0; i < n; i++)
score[i] += get * a[i][task];
}
for (int i = 0; i < n; i++) {
for (int task = 0; task < t; task++) {
tasks[i] += a[i][task];
}
}
int ind[n];
iota(ind, ind + n, 0);
sort(ind, ind + n, [&](int i, int j) {
return make_tuple(score[i], tasks[i], -i) > make_tuple(score[j], tasks[j], -j);
});
// for (int x = 0; x < n; cout << score[x++] << " ");
cout << score[p-1] << " " << find(ind, ind + n, p-1) - ind + 1;
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
// int t; cin >> t; while (t--)
solve();
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |