Submission #322015

#TimeUsernameProblemLanguageResultExecution timeMemory
322015aaronhmaPoi (IOI09_poi)C++17
70 / 100
353 ms8940 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<long long> vll; typedef pair<int, int> pii; typedef pair<long long, long long> pll; struct Person { int val; int id; }; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, t, p, num; cin >> n >> t >> p; unordered_map<int, int> points; vector<vector<bool>> solved(n, vector<bool>(t)); for (int i = 0; i < n; i++) { for (int j = 0; j < t; j++) { cin >> num; if (num == 0) { points[j]++; solved[i][j] = false; } else { solved[i][j] = true; } } } vector<Person> people(n); for (int i = 0; i < n; i++) { people[i].id = i + 1; for (int j = 0; j < t; j++) { if (solved[i][j]) { people[i].val += points[j]; } } } sort(people.begin(), people.end(), [](const Person &a, const Person &b) { if (a.val == b.val) return a.id < b.id; return a.val > b.val; }); int score = -1, rank = -1; for (int i = 0; i < n; i++) { if (people[i].id == p) { score = people[i].val; rank = i + 1; } } cout << score << " " << rank << "\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...