# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
683507 | JooDdae | Table Tennis (info1cup20_tabletennis) | C++17 | 69 ms | 4624 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;
using ll = long long;
int n, k, a[200200];
int main(){
cin.tie(0)->sync_with_stdio(0);
cin >> n >> k;
for(int i=1;i<=n+k;i++) cin >> a[i];
for(int A=0;A<=k;A++) for(int B=0;A+B<=k;B++) {
int L = A+1, R = n+k-B;
int S = a[L] + a[R];
int l = L+1, r = R-1;
vector<array<int, 2>> v = {{L, R}};
while(l < r && v.size()+(r-l+1)/2 >= n/2) {
if(a[l] + a[r] == S) {
v.push_back({l, r});
l++, r--;
continue;
}
if(S-a[l] > a[r]) l++;
else r--;
}
if(v.size() >= n/2) {
for(int i=0;i<n/2;i++) cout << a[v[i][0]] << " ";
for(int i=n/2-1;i>=0;i--) cout << a[v[i][1]] << " ";
return 0;
}
}
assert(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... |