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
vector <int> sums;
signed main () {
int n, k, c;
cin >> n >> k >> c;
int arr[n][k]; for (int i = 0; i < n; i++) for (int j = 0; j < k; j++) cin >> arr[i][j];
if (k == 1) {
for (int i = 0; i < n; i++) {
int sum = 0;
for (int j = 0; j < k; j++) {
sum += arr[i][j];
}
sums.push_back(sum);
}
} else {
for (int i = 0; i < n; i++) {
for (int j = 0; j < i; j++) {
int sum = 0;
for (int l = 0; l < k; l++) {
sum += max(arr[i][l], arr[j][l]);
}
sums.push_back(sum);
}
}
}
sort(sums.begin(), sums.end());
reverse(sums.begin(), sums.end());
cout << sums[c - 1] << '\n';
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |