# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
667661 | LFFB | Table Tennis (info1cup20_tabletennis) | C++14 | 80 ms | 2480 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 != 1) return 1;
m = n + k;
for (int i = 0; i < m; i++) {
scanf("%d", &input[i]);
}
std::sort(input, input+m);
int bad = -1;
// find bad one
for (int x = 0; x < m; x++) {
debug("at x = %d\n", x);
int i = 0;
int j = m-1;
if (i == x) i++;
if (j == x) 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 (j == x) j--;
}
if (valid) {
bad = input[x];
debug("bad = input[%d] = %d\n", x, input[x]);
break;
}
}
for (int i = 0; i < m; i++) {
if (input[i] == bad) 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... |