# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1224188 | sleepntsheep | Olympiads (BOI19_olympiads) | C++17 | 6 ms | 836 KiB |
#include <stdio.h>
#include <algorithm>
using namespace std;
#define N 505
#define K 3
int n, c, k, a[N][K], cc[N * N], tp;
int main() {
scanf("%d%d%d", &n, &k, &c);
for (int i = 0; i < n; ++i)
for (int j = 0; j < k; ++j)
scanf("%d", &a[i][j]);
if (k == 2) {
for (int i = 0; i < n; ++i)
for (int j = i + 1; j < n; ++j) {
cc[tp++] = -max(a[i][0], a[j][0]) + -max(a[j][1], a[i][1]);
}
sort(cc, cc + tp);
printf("%d\n", -cc[c - 1]);
} else {
for (int i = 0; i < n; ++i)
cc[tp++] = -a[i][0];
sort(cc, cc + tp);
printf("%d\n", -cc[c - 1]);
}
return 0;
}
Compilation message (stderr)
# | 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... |