# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
735070 | NintsiChkhaidze | Table Tennis (info1cup20_tabletennis) | C++17 | 3019 ms | 5828 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>
#define pb push_back
#define f first
#define s second
#define int long long
using namespace std;
const int N = 2e5+5,inf = 1e9;
int a[N],n,k;
vector <int> v;
void check(int sum){
v.clear();
int r = n + k;
for (int i = 1; i <= n + k; i++){
while (i < r){
if (a[i] + a[r] > sum) {
r--;
continue;
}
break;
}
if (i < r && a[i] + a[r] == sum){
v.pb(a[i]),v.pb(a[r]);
r--;
}
}
if (v.size() == n){
sort(v.begin(),v.end());
for (int x: v) cout<<x<<" ";
cout<<endl;
exit(0);
}
}
signed main (){
ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
cin>>n>>k;
for (int i = 1; i <= n+k;i++)
cin>>a[i];
for (int i = 1; i <= k+1; i++){
int c=0;
for (int j = n + k; j > i; j--){
++c;
if (c > k+1) break;
check(a[i] + a[j]);
}
}
}
/*
4 7
1 3 4 5 6 8 9 100 200 431 1234
*/
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... |