# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
477114 | glome | Poi (IOI09_poi) | C++17 | 320 ms | 23860 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;
struct S {
int points = 0;
int tasks = 0;
int ID;
};
bool cmp(S A, S B) {
if(A.points != B.points) {
return A.points > B.points;
}
if(A.tasks != B.tasks) {
return A.tasks > B.tasks;
}
return A.ID < B.ID;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int N, T, P;
cin >> N >> T >> P;
P--;
vector<vector<int>> y(N, vector<int> (T));
vector<S> ans(N);
for (int i = 0; i<N; i++) {
for (int j = 0; j<T; j++) {
cin >> y[i][j];
}
}
vector<int> scores(T);
for (int i = 0; i<T; i++) {
int score = 0;
for (int j = 0; j<N; j++) {
score += y[j][i];
}
scores[i] = (N - score);
}
for (int i = 0; i<T; i++) {
for (int j = 0; j<N; j++) {
if(y[j][i] == 1) {
ans[j].tasks++;
ans[j].ID = j;
ans[j].points += scores[i];
}
}
}
sort(ans.begin(), ans.end(), cmp);
for (int i = 0; i<ans.size(); i++) {
if(ans[i].ID == P) {
cout << ans[i].points << ' ' << i + 1 << '\n';
return 0;
}
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |