제출 #1034942

#제출 시각아이디문제언어결과실행 시간메모리
1034942ArthuroWichPoi (IOI09_poi)C++17
100 / 100
159 ms39764 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int struct con { int p = 0, t = 0, id = 0; }; bool cmp(con a, con b) { if (a.p != b.p) { return a.p < b.p; } else if (a.t != b.t) { return a.t < b.t; } else { return a.id > b.id; } } void solve() { int n, t, p; cin >> n >> t >> p; vector<int> task(t, n); p--; vector<vector<int>> contestant(n, vector<int>(t)); for (int i = 0; i < n; i++) { for (int j = 0; j < t; j++) { cin >> contestant[i][j]; if (contestant[i][j]) { task[j]--; } } } vector<con> ans; for (int i = 0; i < n; i++) { con a; a.id = i; for (int j = 0; j < t; j++) { if (contestant[i][j]) { a.t++; a.p += task[j]; } } ans.push_back(a); } sort(ans.rbegin(), ans.rend(), cmp); for (int i = 0; i < n; i++) { if (ans[i].id == p) { cout << ans[i].p << " " << i+1 << endl; return; } } } int32_t main() { ios::sync_with_stdio(0); cin.tie(0); int t; t = 1; while(t--) { solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...