Submission #1260248

#TimeUsernameProblemLanguageResultExecution timeMemory
1260248kawhietPoi (IOI09_poi)C++20
0 / 100
146 ms16192 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n, m, p; cin >> n >> m >> p; vector<int> c(m); vector<int> cnt(n); vector<vector<int>> a(n, vector<int>(m)); for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { cin >> a[i][j]; cnt[i] += a[i][j]; c[j] += 1 - a[i][j]; } } vector<pair<int, int>> score(n); for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { score[i].first += a[i][j] * c[j]; } score[i].second = i; } sort(score.begin(), score.end(), [&](pair<int, int> x, pair<int, int> y) { if (x.first == y.first) { if (cnt[x.second] == cnt[y.second]) { return x.second < y.second; } return cnt[x.second] > cnt[y.second]; } return x.first > y.first; }); for (int i = 0; i < n; i++) { if (score[i].second == p - 1) { cout << score[i].first << ' ' << score[i].second + 1 << '\n'; return 0; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...