# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
659777 | Tob | Poi (IOI09_poi) | C++14 | 524 ms | 16084 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>
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair <ll, ll> pii;
const int N = 2007;
struct dat {
int pts, sl, id;
};
int n, t, p;
int mat[N][N];
int pt[N], cpt[N], slv[N];
bool cmp(dat a, dat b) {
if (a.pts != b.pts) return a.pts > b.pts;
if (a.sl != b.sl) return a.sl > b.sl;
return a.id < b.id;
}
int main () {
cin >> n >> t >> p;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= t; j++) {
cin >> mat[i][j];
pt[j] += (mat[i][j] ^ 1);
slv[i] += mat[i][j];
}
}
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= t; j++) {
cpt[i] += pt[j] * mat[i][j];
}
}
vector <dat> v;
for (int i = 1; i <= n; i++) {
v.pb({cpt[i], slv[i], i});
}
sort(all(v), cmp);
cout << cpt[p] << " ";
for (int i = 0; i < n; i++) {
if (v[i].id == p) {
cout << i+1;
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |