제출 #440186

#제출 시각아이디문제언어결과실행 시간메모리
440186dxz05Poi (IOI09_poi)C++14
100 / 100
838 ms4404 KiB
#include <bits/stdc++.h> using namespace std; const int MAXN = 2022; bool sol[MAXN][MAXN]; int cnt[MAXN]; pair<pair<int, int>, int> a[MAXN]; int points[MAXN], solved[MAXN]; int main(){ int N, M, P; cin >> N >> M >> P; for (int i = 1; i <= N; i++){ for (int j = 1; j <= M; j++){ cin >> sol[i][j]; cnt[j] += sol[i][j]; } } vector<int> v(N); for (int i = 1; i <= N; i++){ v[i - 1] = i; for (int j = 1; j <= M; j++){ if (sol[i][j]){ points[i] += N - cnt[j]; solved[i]++; } } // cout << points[i] << ' ' << solved[i] << endl; } sort(v.begin(), v.end(), [](int i, int j){ if (points[i] > points[j]) return true; if (points[i] == points[j] && solved[i] > solved[j]) return true; if (points[i] == points[j] && solved[i] == solved[j]) return i < j; return false; }); cout << points[P] << ' '; for (int i = 0; i < N; i++){ if (v[i] == P){ cout << i + 1 << endl; return 0; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...