# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
365815 | fadi57 | Table Tennis (info1cup20_tabletennis) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mx=100005;
const int mod= 1e9+7 ;
const ll inf=1e12+4;
//***while there is life there is hope
int n,k;
int main() {
//ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
cin>>n>>k;
int nteams=n/2;
map<int,int>mp;l
l sum=0;
ll a[n+k+5];
for(int i=0;i<n+k;i++){
cin>>a[i];
sum+=a[i];
mp[a[i]]++;
}
int ans=0;
/*
4
1
1 2 5 6 100
1 2 5 6 100
*/
int can=-1;
for(int i=0;i<n+k;i++){
int sum2=sum-a[i];
mp[a[i]]=0;
int target=sum2/nteams;int ok=1;
if(sum2%nteams!=0){continue;}else{
int f=0;int en=n+k-1;
for(int j=0;j<nteams;j++){
if(f==i){f++;} if(en==i){en--;}
// cout<<f<<" "<<en<<" "<<a[f]+a[en]<<endl;
if(a[f]+a[en]!=target){ok=0;break;}
f++;en--;
}
if(ok){can=i;}break;;
}
}
for(int i=0;i<n+k;i++){
if(i!=can){cout<<a[i]<<" ";}
}
}