Submission #1231551

#TimeUsernameProblemLanguageResultExecution timeMemory
1231551countlessPoi (IOI09_poi)C++20
50 / 100
143 ms9520 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define sp <<" "<< #define endl "\n" void solve() { int n, t, p; cin >> n >> t >> p; p--; vector<vector<int>> solve(n); vector<int> score(n), task(t); for (int i = 0; i < n; i++) { for (int j = 0; j < t; j++) { int solved; cin >> solved; if (solved) { solve[i].push_back(j); task[j]++; } } } vector<int> weight(t); for (int j = 0; j < t; j++) { weight[j] = n - task[j]; } for (int i = 0; i < n; i++) { for (auto &j : solve[i]) { score[i] += weight[j]; } } vector<int> o(n); iota(o.begin(), o.end(), 0); sort(o.rbegin(), o.rend(), [&](int a, int b) { return score[a] < score[b]; }); for (int i= 0; i < n; i++) { if (o[i] == p) { cout << score[p] sp i + 1 << endl; } } } signed main() { cin.tie(0); ios_base::sync_with_stdio(false); int t = 1; // cin >> t; while (t--) solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...