Submission #659777

#TimeUsernameProblemLanguageResultExecution timeMemory
659777TobPoi (IOI09_poi)C++14
100 / 100
524 ms16084 KiB
#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 timeMemoryGrader output
Fetching results...