# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
754141 | vjudge1 | Poi (IOI09_poi) | C++17 | 225 ms | 15984 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 == a.se.se) {
if(a.se.fi == a.se.fi) return a.fi < b.fi;
else return a.se.fi > b.se.fi;
}
else return a.se.se > b.se.se;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int n, t, p;
cin >> n >> t >> p;
p-=1;
// 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;
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;
}
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |