# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1034942 | ArthuroWich | Poi (IOI09_poi) | C++17 | 159 ms | 39764 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 int long long int
struct con {
int p = 0, t = 0, id = 0;
};
bool cmp(con a, con b) {
if (a.p != b.p) {
return a.p < b.p;
} else if (a.t != b.t) {
return a.t < b.t;
} else {
return a.id > b.id;
}
}
void solve() {
int n, t, p;
cin >> n >> t >> p;
vector<int> task(t, n);
p--;
vector<vector<int>> contestant(n, vector<int>(t));
for (int i = 0; i < n; i++) {
for (int j = 0; j < t; j++) {
cin >> contestant[i][j];
if (contestant[i][j]) {
task[j]--;
}
}
}
vector<con> ans;
for (int i = 0; i < n; i++) {
con a;
a.id = i;
for (int j = 0; j < t; j++) {
if (contestant[i][j]) {
a.t++;
a.p += task[j];
}
}
ans.push_back(a);
}
sort(ans.rbegin(), ans.rend(), cmp);
for (int i = 0; i < n; i++) {
if (ans[i].id == p) {
cout << ans[i].p << " " << i+1 << endl;
return;
}
}
}
int32_t main() {
ios::sync_with_stdio(0);
cin.tie(0);
int t;
t = 1;
while(t--) {
solve();
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |