제출 #562935

#제출 시각아이디문제언어결과실행 시간메모리
562935Drew_Poi (IOI09_poi)C++17
100 / 100
289 ms4908 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back const int MAX = 2069; int N, M, P; bool ar[MAX][MAX]; int score[MAX]; int main() { ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> N >> M >> P; for (int j = 1; j <= M; ++j) score[j] = N; for (int i = 1; i <= N; ++i) { for (int j = 1; j <= M; ++j) { cin >> ar[i][j]; score[j] -= ar[i][j]; } } vector<array<int, 3>> v; for (int i = 1; i <= N; ++i) { int sum = 0, solved = 0; for (int j = 1; j <= M; ++j) if (ar[i][j]) sum += score[j], solved++; v.pb({sum, solved, -i}); } sort(v.rbegin(), v.rend()); for (int i = 0; i < N; ++i) { if (-v[i][2] == P) { cout << v[i][0] << " " << i+1 << '\n'; break; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...