# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
756479 | Alkarat | Table Tennis (info1cup20_tabletennis) | C++14 | 130 ms | 4664 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;
const int N=2e5+5;
int n,k,a[N];
map<int,int>ck;
bool check(int l,int r)
{
int sum=a[l]+a[r],eli=0;
vector<int>g;
while(l<r)
{
if(a[l]+a[r]==sum)
{
g.push_back(a[l]);
g.push_back(a[r]);
l++;
r--;
}
else if(a[l]+a[r]>sum)
{
r--;
eli++;
}
else
{
l++;
eli++;
}
if(eli>k) return 0;
if(g.size()==n)
{
sort(g.begin(),g.end());
for(int e:g) cout<<e<<" ";
return 1;
}
}
return 0;
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>n>>k;
for(int i=1; i<=n+k; i++) cin>>a[i];
for(int i=1; i<=k+1; i++) for(int j=n+k; j>=i+n-1; j--) if(check(i,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... |