제출 #423755

#제출 시각아이디문제언어결과실행 시간메모리
423755haxormanPoi (IOI09_poi)C++14
55 / 100
322 ms16136 KiB
#include <bits/stdc++.h> using namespace std; const int mxN = 2007; int tasks[mxN], solved[mxN][mxN]; pair<int,pair<int,int>> points[mxN]; int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, t, p; cin >> n >> t >> p; for (int i = 1; i <= n; ++i) { for (int j = 1; j <= t; ++j) { cin >> solved[i][j]; if (!solved[i][j]) tasks[j]++; } } for (int i = 1; i <= n; ++i) { int cur = 0, cnt = 0; for (int j = 1; j <= n; ++j) { if (solved[i][j]) { cnt++; cur += tasks[j]; } } points[i] = {cur, {cnt, i}}; } sort(points + 1, points + n + 1, greater<pair<int,pair<int,int>>>()); for (int iter = 1; iter <= n; ++iter) { for (int i = 2; i <= n; ++i) { if (points[i].first == points[i - 1].first && points[i].second.first == points[i - 1].second.first && points[i].second.second < points[i - 1].second.second) { swap(points[i], points[i - 1]); } } } for (int i = 1; i <= n; ++i) { if (points[i].second.second == p) { cout << points[i].first << ' ' << i << "\n"; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...