답안 #927023

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
927023 2024-02-14T06:57:17 Z blacktulip Table Tennis (info1cup20_tabletennis) C++17
87 / 100
3000 ms 4696 KB
#include <bits/stdc++.h>
 
using namespace std;
 
#define ort ((bas+son)/2)
#define int long long
#define endl "\n"
 
int n,k,a[200005],ind;
bool vis[200005];
 
inline bool check(int l,int r,int sum){
	int say=0;
	while(l<r){
		//~ if(vis[l]){l++;continue;}
		//~ if(vis[r]){r--;continue;}
		if(a[l]+a[r]==sum){
			l++;
			r--;
			say++;
		}
		else if(a[l]+a[r]<sum){
			ind=l;
			vis[l]=1;
			l++;
		}
		else{
			ind=r;
			vis[r]=1;
			r--;
		}
	}
	if(l==r){ind=l;vis[l]=1;}
	if(say==n/2)return 1;
	return 0;
}
 
int32_t main(void){
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	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>=n;j--){
			if(i>=j)break;
			memset(vis,0,sizeof(vis));
			if(check(1,n+k,a[i]+a[j])){
				//~ cout<<a[i]+a[j]<<endl;
				for(int ii=1;ii<=n+k;ii++){
					if(vis[ii])continue;
					cout<<a[ii]<<" ";
				}
				return 0;
			}
		}
	}
	
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 604 KB Output is correct
2 Correct 1 ms 604 KB Output is correct
3 Correct 1 ms 856 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 860 KB Output is correct
2 Correct 22 ms 3144 KB Output is correct
3 Correct 20 ms 3080 KB Output is correct
4 Correct 21 ms 3164 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 26 ms 3152 KB Output is correct
2 Correct 22 ms 3280 KB Output is correct
3 Correct 22 ms 3164 KB Output is correct
4 Correct 21 ms 4156 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 604 KB Output is correct
2 Correct 22 ms 652 KB Output is correct
3 Correct 1 ms 604 KB Output is correct
4 Correct 12 ms 604 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 604 KB Output is correct
2 Correct 0 ms 604 KB Output is correct
3 Correct 0 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 600 KB Output is correct
2 Correct 2 ms 604 KB Output is correct
3 Correct 1 ms 600 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 1 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 604 KB Output is correct
2 Correct 185 ms 3088 KB Output is correct
3 Correct 25 ms 4248 KB Output is correct
4 Correct 45 ms 4284 KB Output is correct
5 Correct 23 ms 4304 KB Output is correct
6 Correct 34 ms 4168 KB Output is correct
7 Correct 49 ms 4564 KB Output is correct
8 Correct 22 ms 4696 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 604 KB Output is correct
2 Execution timed out 3066 ms 1628 KB Time limit exceeded
3 Halted 0 ms 0 KB -