제출 #937870

#제출 시각아이디문제언어결과실행 시간메모리
937870Muaath_5Poi (IOI09_poi)C++17
10 / 100
180 ms15988 KiB
#include <bits/stdc++.h> #define ll long long #define pll pair<ll, ll> using namespace std; const int N = 2009; int n, t, p; int solved[N][N]; int points[N]; struct contestant { int id = 0; int score = 0; int count = 0; friend bool operator<(contestant a, contestant b) { if (a.score == b.score) { if (a.count == b.count) { return a.id > b.id; } return a.count < b.count; } return a.score < b.score; } } c[N]; int main() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); cin >> n >> t >> p; for (int i = 1; i <= n; i++) { c[i].id = i; for (int j = 1; j <= t; j++) { cin >> solved[i][j]; c[i].count++; if (solved[i][j]) points[j]++; } } for (int j = 1; j <= t; j++) points[j] = n - points[j]; for (int i = 1; i <= n; i++) { for (int j = 1; j <= t; j++) { if (solved[i][j]) c[i].score += points[j]; } } sort(c, c + n); reverse(c, c + n); for (int i = 1; i <= n; i++) { if (c[i].id == p) { cout << c[i].score << ' ' << i << '\n'; return 0; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...