Submission #1260257

#TimeUsernameProblemLanguageResultExecution timeMemory
1260257kawhietPoi (IOI09_poi)C++20
0 / 100
146 ms16176 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<vector<int>> d(n, vector<int>(m)); for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { cin >> d[i][j]; } } vector<int> b(m), cnt(n); for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { cnt[i] += d[i][j]; b[j] += 1 - d[i][j]; } } vector<array<int, 2>> a(n); for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { a[i][0] += d[i][j] * b[j]; } a[i][1] = i; } sort(a.begin(), a.end(), [&](array<int, 2> x, array<int, 2> y) { if (x[0] != y[0]) return x[0] > y[0]; if (cnt[x[1]] != cnt[y[1]]) return cnt[x[1]] > cnt[y[1]]; return x[1] < y[1]; }); for (int i = 0; i < n; i++) { if (a[i][1] == p - 1) { cout << a[i][0] << ' ' << a[i][1] + 1 << '\n'; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...