Submission #399385

#TimeUsernameProblemLanguageResultExecution timeMemory
399385iulia13Poi (IOI09_poi)C++14
5 / 100
694 ms23748 KiB
#include <iostream> #include <algorithm> using namespace std; const int nmax = 2005; int a[nmax][nmax]; int v[nmax]; struct ura{ int sc, id; }; ura b[nmax]; bool cmp(ura x, ura y) { if (x.sc != y.sc) return x.sc < y.sc; return x.id < y.id; } int main() { int n, t, p, i, j; cin >> n >> t >> p; for (i = 1; i <= n; i++) for (j = 1; j <= t; j++) cin >> a[i][j]; for (j = 1; j <= t; j++) for (i = 1; i <= n; i++) v[j] += (1 - a[i][j]); for (i = 1; i <= n; i++) { b[i].id = i; for (j = 1; j <= t; j++) b[i].sc += a[i][j] * v[j]; } sort (b + 1, b + n + 1, cmp); for (i = 1; i <= n; i++) if (b[i].id == p) { cout << b[i].sc << " " << i; return 0; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...