# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
754139 | vjudge1 | Poi (IOI09_poi) | C++17 | 282 ms | 19612 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 fi first
#define se second
typedef long long ll;
typedef unsigned long long ull;
bool comparator(pair<int, pair<int, int>> &a, pair<int, pair<int, int>> &b) {
if(a.se.se != b.se.se) return a.se.se > b.se.se;
if(a.se.fi != b.se.se) return a.se.fi > b.se.fi;
else return a.fi < b.fi;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int n, t, p;
cin >> n >> t >> p;
// input & data nilai 0 (nilai tambah)
int nilai[n][t], skortempo[t];
memset(skortempo, 0, sizeof(skortempo));
for(int i=0; i<n; i++) {
for(int j=0; j<t; j++) {
cin >> nilai[i][j];
if(nilai[i][j] == 0) skortempo[j]++;
}
}
pair <int, pair <int, int>> data[n]; // id, (solved task count, nilai total)
for(int i=0; i<n; i++) {
data[i].fi = i+1;
data[i].se.fi = 0;
data[i].se.se = 0;
for(int j=0; j<t; j++) {
if(nilai[i][j] != 0) {
data[i].se.se += skortempo[j];
data[i].se.fi++;
}
}
}
sort(data, data+n, comparator);
for(int i=0; i<n; i++) {
if(data[i].fi == p) {
cout << data[i].se.se << " " << i+1;
break;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |