# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
501506 | aryan12 | Poi (IOI09_poi) | C++17 | 254 ms | 39620 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 int long long
mt19937_64 RNG(chrono::steady_clock::now().time_since_epoch().count());
bool cmp(array<int, 3> a, array<int, 3> b) {
if(a[0] == b[0]) {
if(a[1] == b[1]) {
return a[2] < b[2];
}
return a[1] > b[1];
}
return a[0] > b[0];
}
void Solve() {
int n, t, p;
cin >> n >> t >> p;
int a[n + 1][t + 1];
for(int i = 1; i <= n; i++) {
for(int j = 1; j <= t; j++) {
cin >> a[i][j];
}
}
int points[t + 1];
for(int j = 1; j <= t; j++) {
int cnt = 0;
for(int i = 1; i <= n; i++) {
cnt += 1 - a[i][j];
}
points[j] = cnt;
}
vector<array<int, 3> > ranking;
for(int i = 1; i <= n; i++) {
int cnt_of_points = 0, cnt_of_solves = 0;
for(int j = 1; j <= t; j++) {
if(a[i][j] == 1) {
cnt_of_solves++;
cnt_of_points += points[j];
}
}
ranking.push_back({cnt_of_points, cnt_of_solves, i});
}
sort(ranking.begin(), ranking.end(), cmp);
for(int i = 0; i < ranking.size(); i++) {
if(ranking[i][2] == p) {
cout << ranking[i][0] << " " << i + 1 << "\n";
return;
}
}
assert(false);
}
int32_t main() {
auto begin = std::chrono::high_resolution_clock::now();
ios_base::sync_with_stdio(0);
cin.tie(0);
int t = 1;
//cin >> t;
while(t--) {
Solve();
}
auto end = std::chrono::high_resolution_clock::now();
auto elapsed = std::chrono::duration_cast<std::chrono::nanoseconds>(end - begin);
cerr << "Time measured: " << elapsed.count() * 1e-9 << " seconds.\n";
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |