# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
927943 | TAhmed33 | Poi (IOI09_poi) | C++98 | 468 ms | 39548 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |