이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 16e4+10;
int v[MAXN];
int main()
{
cin.tie(0)->sync_with_stdio(0);
int n,k;
cin >> n >> k;
for(int i = 0; i < n+k; i++)
cin >> v[i];
sort(v,v+(n+k));
int curini, curfim;
int base;
for(int j = 0; j < n+k; j++)
{
int aux = v[j];
v[j] = -1;
int marc = 0;
int marc2 = 0;
for(int i = 0; i < (n+k)/2; i++)
{
curini = v[i+marc];
curfim = v[n+k-i-1+marc2];
if(curini == -1)
{
marc++;
curini = v[i+marc];
}
if(curfim == -1)
{
marc2--;
curfim = v[n+k-i-1+marc2];
}
if(i == 0) base = curfim+curini;
else if(curini+curfim != base)
{
//cerr << "--------------------------------------------------------\n";
//cerr << curini << " " << curfim;
//cerr << "\n";
//cerr << i+marc << " " << (n+k-i-1+marc2);
//cerr << "\n";
//cerr << j << " " << aux << "\n";
//cerr << base << "\n";
//cerr << "--------------------------------------------------------\n";
break;
}
if(i == ((n+k)/2)-1)
{
for(int i = 0; i < n+k; i++)
{
if(v[i] != -1)
{
cout << v[i];
if(i != n+k-1) cout << " ";
}
}
return 0;
}
}
v[j] = aux;
}
//for(int i = 0; i < n; i++)
// cout << v[i] << " ";
}
# | 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... |