# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
999523 | SonicML | Poi (IOI09_poi) | C++14 | 388 ms | 12200 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 Cow {
int score;
int solve;
int id;
};
bool compareCow(Cow a, Cow b) {
if(a.score == b.score) {
if(a.solve == b.solve) {
return (a.id < b.id);
}
return (a.solve > b.solve);
}
return (a.score > b.score);
}
int const NMAX = 2000;
int freq[1 + NMAX];
Cow arr[1 + NMAX];
bool mat[1 + NMAX][1 + NMAX];
int main() {
int n, t, p;
cin >> n >> t >> p;
for(int i = 1;i <= n;i++) {
for(int j = 1;j <= t;j++) {
cin >> mat[i][j];
freq[j] += mat[i][j];
}
}
for(int i = 1;i <= n;i++) {
arr[i].id = i;
for(int j = 1;j <= t;j++) {
if(mat[i][j] == 1) {
arr[i].score += (n - freq[j]);
arr[i].solve++;
}
}
}
sort(arr+1, arr+n+1, compareCow);
for(int i = 1;i <= n;i++) {
if(arr[i].id == p) {
cout << arr[i].score << ' ' << i << '\n';
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |