제출 #1097418

#제출 시각아이디문제언어결과실행 시간메모리
1097418vjudge1Poi (IOI09_poi)C++17
100 / 100
199 ms39632 KiB
#include "bits/stdc++.h" using namespace std; #ifndef LOCAL #define debug(...) #endif #define SZ(x) ((int) x.size()) #define int long long #define vi vector<int> #define vvi vector<vector<int>> #define endl '\n' #define pii pair<int, int> #define all(v) (v).begin(), (v).end() template <typename T> istream &operator>>(istream& is, vector<T> &v) { for (auto &x: v) is >> x; return is; } struct cand { int score, solved, id; }; void run_test() { int n, t, p; cin >> n >> t >> p; p--; vector<vector<int>> a(n, vector<int>(t)); cin >> a; vector<int> points(t, 0); for (int i = 0; i < t; i++) { for (int j = 0; j < n; j++) { points[i] += (a[j][i] == 0); } } vector<int> score(n, 0); for (int i = 0; i < n; i++) { for (int j = 0; j < t; j++) { score[i] += a[i][j] * (points[j]); } } vector<int> solved(n, 0); for (int i = 0; i < n; i++) { for (int j = 0; j < t; j++) { solved[i] += (a[i][j] == 1); } } vector<cand> v; for (int i = 0; i < n; i++) { v.push_back({ score[i], solved[i], i }); } sort(all(v), [](cand a, cand b) { if (a.score > b.score) return true; if (a.score == b.score) { if (a.solved > b.solved) return true; if (a.solved == b.solved) return a.id < b.id; return false; } return false; }); for (int i = 0; i < n; i++) { if (v[i].id == p) { cout << v[i].score << " " << i+1 << endl; return; } } } int32_t main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int tc = 1; // cin >> tc; while (tc--) { run_test(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...