Submission #518593

#TimeUsernameProblemLanguageResultExecution timeMemory
518593bluePoi (IOI09_poi)C++17
100 / 100
557 ms23824 KiB
#include <iostream> #include <vector> using namespace std; int main() { int N, T, P; cin >> N >> T >> P; vector<int> S(T+1, 0); vector<int> TC(N+1, 0); int** solved = new int*[N+1]; for(int i = 1; i <= N; i++) solved[i] = new int[T+1]; for(int i = 1; i <= N; i++) for(int j = 1; j <= T; j++) { cin >> solved[i][j]; S[j] += solved[i][j]; TC[i] += solved[i][j]; } vector<int> score(N+1, 0); for(int i = 1; i <= N; i++) for(int j = 1; j <= T; j++) score[i] += solved[i][j] * (N - S[j]); int r = 1; for(int i = 1; i < P; i++) if(score[i] > score[P] || (score[i] == score[P] && TC[i] >= TC[P])) r++; for(int i = P+1; i <= N; i++) if((score[i] > score[P]) || (score[i] == score[P] && TC[i] > TC[P])) r++; cout << score[P] << ' ' << r << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...