# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
667641 | pedroslrey | Table Tennis (info1cup20_tabletennis) | C++14 | 3117 ms | 721992 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;
map<int, int> vals;
bool test(vector<int> &xs, int n, int k, int x) {
vector<int> marc(n + k);
vector<int> pairs;
for (int i = 0; i < n + k; ++i)
if (!marc[i+1] && vals[x - xs[i]] != 0 && vals[x - xs[i]] != i + 1) {
pairs.push_back(xs[i]);
pairs.push_back(x - xs[i]);
marc[vals[x - xs[i]]] = true;
}
sort(pairs.begin(), pairs.end());
if (pairs.size() >= n) {
for (int i = 0; i < n; ++i)
cout << pairs[i] << " ";
cout << "\n";
return true;
}
return false;
}
int main() {
int n, k;
cin >> n >> k;
vector<int> xs(n+k);
for (int &x: xs)
cin >> x;
for (int i = 0; i < n + k; ++i)
vals[xs[i]] = i + 1;
for (int i = 0; i < n + k; ++i)
for (int j = i+1; j < n + k; ++j)
if (test(xs, n, k, xs[i] + xs[j])) 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... |
# | 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... |