# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1080420 | vjudge1 | Poi (IOI09_poi) | C++17 | 399 ms | 24020 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 <iostream>
#include <vector>
#include <algorithm>
using namespace std;
struct part {
int id;
int sc;
int sv;
};
bool comp(const part&a, const part&b) {
if (a.sc != b.sc) return a.sc > b.sc;
if (a.sv != b.sv) return a.sv > b.sv;
return a.id < b.id;
}
int main() {
int n, t, p;
cin >> n >> t >> p;
vector<vector<int>> v(n, vector<int>(t));
vector<int> sum(t, 0);
vector<part> pr(n);
for (int i = 0; i < n; i++) {
for (int j = 0; j < t; j++) {
cin >> v[i][j];
}
}
for (int j = 0; j < t; j++) {
for (int i = 0; i < n; i++) {
if (v[i][j] == 0) sum[j]++;
}
}
for (int i = 0; i < n; i++) {
pr[i].id = i + 1;
pr[i].sc = 0;
pr[i].sv = 0;
for (int j = 0; j < t; j++) {
if (v[i][j] == 1) {
pr[i].sc += sum[j];
pr[i].sv++;
}
}
}
sort(pr.begin(), pr.end(), comp);
int fsc = 0, rank = 1;
for (int i = 0; i < n; i++) {
if (pr[i].id == p) {
fsc = pr[i].sc;
rank = i + 1;
break;
}
}
cout << fsc << ' ' << rank;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |