# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
667676 | LFFB | Table Tennis (info1cup20_tabletennis) | C++14 | 3059 ms | 840 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 <iostream>
#include <algorithm>
#define debug(args...) //printf(args)
const int MAX_M = 16e4;
typedef long long llong;
int n, m, k;
int input[MAX_M];
int main() {
scanf("%d %d", &n, &k);
if (k != 2) return 1;
m = n + k;
for (int i = 0; i < m; i++) {
scanf("%d", &input[i]);
}
std::sort(input, input+m);
int bad1 = -1;
int bad2 = -1;
// find bad one
for (int x = 0; x < m; x++) {
for (int y = x+1; y < m; y++) {
debug("at x = %d\n", x);
int i = 0;
int j = m-1;
if (i == x) i++;
if (i == y) i++;
if (j == x) j--;
if (j == y) j--;
int sum = input[i] + input[j];
bool valid = true;
while (valid) {
if (j < i) break;
if (input[i] + input[j] != sum) {
debug("i=%d, j=%d, %d + %d != %d\n", i, j, input[i], input[j], sum);
valid = false;
}
i++;
j--;
if (i == x) i++;
if (i == y) i++;
if (j == x) j--;
if (j == y) j--;
}
if (valid) {
bad1 = input[x];
bad2 = input[y];
break;
}
}
}
for (int i = 0; i < m; i++) {
if (input[i] == bad1) continue;
if (input[i] == bad2) continue;
printf("%d ", input[i]);
}
printf("\n");
}
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... |
# | 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... |