Submission #937885

#TimeUsernameProblemLanguageResultExecution timeMemory
937885Muaath_5Poi (IOI09_poi)C++17
100 / 100
187 ms16208 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]; if (solved[i][j]) c[i].count++, 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+1, c + n+1); reverse(c+1, c + n+1); 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...