Submission #927943

#TimeUsernameProblemLanguageResultExecution timeMemory
927943TAhmed33Poi (IOI09_poi)C++98
100 / 100
468 ms39548 KiB
#include <bits/stdc++.h> using namespace std; #define int long long signed main () { int n, m, k; cin >> n >> m >> k; int arr[n + 1][m + 1] = {}; int dif[m + 1] = {}; for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { cin >> arr[i][j]; if (!arr[i][j]) dif[j]++; } } vector <vector <int>> ss; for (int i = 1; i <= n; i++) { int cost = 0; int cnt = 0; for (int j = 1; j <= m; j++) { if (arr[i][j]) cost += dif[j], cnt++; } ss.push_back({cost, cnt, i}); } sort(ss.begin(), ss.end(), [] (vector <int> a, vector <int> b) { if (a[0] == b[0] && a[1] == b[1]) return a[2] < b[2]; if (a[0] == b[0]) return a[1] > b[1]; return a[0] > b[0]; }); int u = 1; for (auto i : ss) { if (i[2] == k) { cout << i[0] << " " << u << endl; } u++; } }
#Verdict Execution timeMemoryGrader output
Fetching results...