이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int mxN=2e5;
int n, k, a[mxN];
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cin >> n >> k;
n+=k;
map<int, int> mp;
for(int i=0; i<n; ++i)
cin >> a[i], ++mp[a[i]];
sort(a, a+n);
int cnt=0, pos=1;
for(int i=0; i<n; ++i) {
if(mp[a[i]]==0)
continue;
int nd=a[0]+a[n-1]-a[i];
if(mp[nd]==0)
++cnt, pos=i;
--mp[a[i]], --mp[nd];
}
//cout << cnt << " " << pos << endl;
if(cnt==1) {
int i=0;
for(int cnt=0; i<n&&cnt<n/2; ++i)
if(i!=pos)
cout << a[i] << " ", ++cnt;
for(int j=n-1; j>=i; --j)
if(i!=pos)
cout << a[j] << " ";
return 0;
}
for(int i=0; i<n/2; ++i)
cout << a[i] << " ";
for(int i=n-1; i>=n/2; --i)
cout << a[i] << " ";
return 0;
}
# | 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... |