Submission #657245

#TimeUsernameProblemLanguageResultExecution timeMemory
657245happypotatoPoi (IOI09_poi)C++17
100 / 100
596 ms15956 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n, t, p; cin >> n >> t >> p; int a[n + 1][t]; int score[n + 1], solves[n + 1]; for (int i = 1; i <= n; i++) { score[i] = 0; solves[i] = 0; for (int j = 0; j < t; j++) { cin >> a[i][j]; solves[i] += a[i][j]; } } for (int i = 0; i < t; i++) { int mark = 0; for (int j = 1; j <= n; j++) { mark += (a[j][i] == 0); } for (int j = 1; j <= n; j++) { if (a[j][i]) score[j] += mark; } } int rank = 1; for (int i = 1; i <= n; i++) { if (i == p) continue; if (score[i] > score[p]) rank++; else if (score[i] == score[p]) { if (solves[i] > solves[p]) rank++; else if (solves[i] == solves[p]) { if (i < p) rank++; } } } cout << score[p] << ' ' << rank << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...