Submission #489411

#TimeUsernameProblemLanguageResultExecution timeMemory
489411AlexandruabcdePoi (IOI09_poi)C++14
100 / 100
301 ms16132 KiB
#include <bits/stdc++.h> using namespace std; constexpr int NMAX = 2005; int N, T, P; int mat[NMAX][NMAX]; int cnt[NMAX]; int value[NMAX]; int main () { ios_base::sync_with_stdio(false); cin.tie(nullptr); cin >> N >> T >> P; for (int i = 1; i <= N; ++ i ) for (int j = 1; j <= T; ++ j ) { cin >> mat[i][j]; cnt[i] += mat[i][j]; } for (int j = 1; j <= T; ++ j ) { int val = 0; for (int i = 1; i <= N; ++ i ) val += (1 - mat[i][j]); for (int i = 1; i <= N; ++ i ) value[i] += val * mat[i][j]; } int pos = 0; for (int i = 1; i <= N; ++ i ) { if (value[i] > value[P]) ++ pos; else if (value[i] == value[P] && i != P && (cnt[i] > cnt[P] || (cnt[i] == cnt[P] && i < P))) ++ pos; } cout << value[P] << " " << pos+1 << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...