# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1097418 | vjudge1 | Poi (IOI09_poi) | C++17 | 199 ms | 39632 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;
#ifndef LOCAL
#define debug(...)
#endif
#define SZ(x) ((int) x.size())
#define int long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define endl '\n'
#define pii pair<int, int>
#define all(v) (v).begin(), (v).end()
template <typename T>
istream &operator>>(istream& is, vector<T> &v) {
for (auto &x: v) is >> x;
return is;
}
struct cand {
int score, solved, id;
};
void run_test() {
int n, t, p;
cin >> n >> t >> p;
p--;
vector<vector<int>> a(n, vector<int>(t));
cin >> a;
vector<int> points(t, 0);
for (int i = 0; i < t; i++) {
for (int j = 0; j < n; j++) {
points[i] += (a[j][i] == 0);
}
}
vector<int> score(n, 0);
for (int i = 0; i < n; i++) {
for (int j = 0; j < t; j++) {
score[i] += a[i][j] * (points[j]);
}
}
vector<int> solved(n, 0);
for (int i = 0; i < n; i++) {
for (int j = 0; j < t; j++) {
solved[i] += (a[i][j] == 1);
}
}
vector<cand> v;
for (int i = 0; i < n; i++) {
v.push_back({ score[i], solved[i], i });
}
sort(all(v), [](cand a, cand b) {
if (a.score > b.score) return true;
if (a.score == b.score) {
if (a.solved > b.solved) return true;
if (a.solved == b.solved) return a.id < b.id;
return false;
}
return false;
});
for (int i = 0; i < n; i++) {
if (v[i].id == p) {
cout << v[i].score << " " << i+1 << endl;
return;
}
}
}
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int tc = 1;
// cin >> tc;
while (tc--) {
run_test();
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |