제출 #372887

#제출 시각아이디문제언어결과실행 시간메모리
372887apostoldaniel854Poi (IOI09_poi)C++14
100 / 100
284 ms16164 KiB
#include <bits/stdc++.h> using namespace std; const int MAX_N = 2000; int verdict[1 + MAX_N][1 + MAX_N]; int score[1 + MAX_N]; #define pb push_back struct Participant { int score; int cnt_solved; int id; bool operator < (const Participant &other) const { if (score != other.score) return score > other.score; if (cnt_solved != other.cnt_solved) return cnt_solved > other.cnt_solved; return id < other.id; } }; int main () { ios::sync_with_stdio (false); cin.tie (0); cout.tie (0); int n, t, p; cin >> n >> t >> p; for (int i = 1; i <= n; i++) for (int j = 1; j <= t; j++) cin >> verdict[i][j], score[j] += 1 - verdict[i][j]; vector <Participant> standings; for (int id = 1; id <= n; id++) { int cur_score = 0, cnt = 0; for (int i = 1; i <= t; i++) cur_score += score[i] * verdict[id][i], cnt += verdict[id][i]; standings.pb ({cur_score, cnt, id}); } sort (standings.begin (), standings.end ()); for (int i = 0; i < n; i++) if (standings[i].id == p) cout << standings[i].score << " " << i + 1 << "\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...