# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1119287 | HasanV11010238 | Table Tennis (info1cup20_tabletennis) | C++17 | 57 ms | 4944 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;
#define ll long long
#define mod 1000000007
#define INF 1000000000000000000
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n, k, f = 0;
cin>>n>>k;
vector<ll> v(n + k, 0);
for (int i = 0; i < n + k; i++){
cin>>v[i];
}
vector<int> ti(n + k, 0);
int timer = 0;
for (int i = 0; i < k; i++){
for (int j = n + k - 1; j > max(n - 1, i); j--){
if (f) continue;
timer++;
int skp = i + n + k - j - 1, cnt = 0;
ll su = v[i] + v[j];
int l = i , r = j;
while (skp <= k && l < r && cnt < n){
if (v[l] + v[r] == su){
cnt += 2;
ti[l] = ti[r] = timer;
l++, r--;
}
else if (v[l] + v[r] > su){
skp++;
r--;
}
else{
skp++;
l++;
}
}
if (cnt == n){
int cn = 0;
for (int l = 0; l < n + k; l++){
if (ti[l] == timer){
cout<<v[l]<<" ";
}
}
cout<<"\n";
f = 1;
}
}
}
}
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... |