제출 #767909

#제출 시각아이디문제언어결과실행 시간메모리
767909benjaminkleynPoi (IOI09_poi)C++17
100 / 100
225 ms4372 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define mp make_pair int N, T, P; bool solved[2000][2000]; int value[2000] = {0}; int score[2000] = {0}; int num_solved[2000] = {0}; int rankings[2000]; int main() { cin.tie(0)->sync_with_stdio(0); cin >> N >> T >> P; for (int i = 0; i < N; i++) for (int j = 0; j < T; j++) { cin >> solved[i][j]; if (!solved[i][j]) value[j]++; } for (int i = 0; i < N; i++) for (int j = 0; j < T; j++) if (solved[i][j]) score[i] += value[j], num_solved[i]++; iota(rankings, rankings + N, 0); sort(rankings, rankings + N, [] (const int &x, const int &y) {return mp(score[x], mp(num_solved[x], -x)) > mp(score[y], mp(num_solved[y], -y));}); cout << score[P - 1] << ' '; for (int i = 0; i < N; i++) if (rankings[i] == P - 1) return cout << i + 1 << '\n', 0; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...