| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1368702 | vjudge1 | Table Tennis (info1cup20_tabletennis) | C++20 | 41 ms | 4408 KiB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fi first
#define se second
#define pb push_back
int n,k, ar[150401];
vector<int> val(int l, int r){
int rem=l-1 + n+k-r;
if(rem>k) return vector<int>();
vector<int> res;
int sum=ar[l]+ar[r];
while(l<r){
if(ar[l]+ar[r]==sum){res.pb(ar[l++]); res.pb(ar[r--]);}
else if(ar[l]+ar[r]>sum){r--; rem++;}
else if(ar[l]+ar[r]<sum){l++; rem++;}
if(rem>k) return vector<int>();
}
return (rem==k ? res : vector<int>());
}
signed main(){
ios_base::sync_with_stdio(false); cin.tie(nullptr);
cin >> n >> k;
for(int i=1;i<=n+k;i++) cin >> ar[i];
for(int l=1;l<=k+1;l++){
for(int r=l+n-1;r<=n+k;r++){
vector<int> res=val(l,r);
if(!res.empty()){
sort(res.begin(), res.end());
for(int el : res) cout << el << ' ';
//pls
return 0;
}
}
}
}| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
