제출 #703275

#제출 시각아이디문제언어결과실행 시간메모리
703275finn__Poi (IOI09_poi)C++17
100 / 100
574 ms8712 KiB
#include <bits/stdc++.h> using namespace std; #define N 2000 bitset<N> solved[N]; unsigned num_solved[N], contestant_num_solved[N], score[N], ranking[N]; bool compare_contestant(unsigned a, unsigned b) { if (score[a] == score[b]) { if (contestant_num_solved[a] == contestant_num_solved[b]) return a < b; return contestant_num_solved[a] > contestant_num_solved[b]; } return score[a] > score[b]; } int main() { size_t n, t, p; cin >> n >> t >> p; for (size_t i = 0; i < n; i++) { for (size_t j = 0; j < t; j++) { unsigned x; cin >> x; solved[i][j] = x; contestant_num_solved[i] += x; num_solved[j] += x; } ranking[i] = i; } for (size_t i = 0; i < n; i++) for (size_t j = 0; j < t; j++) if (solved[i][j]) score[i] += n - num_solved[j]; sort(ranking, ranking + n, compare_contestant); for (size_t i = 0; i < n; i++) if (ranking[i] + 1 == p) cout << score[p - 1] << ' ' << i + 1 << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...