Submission #775673

# Submission time Handle Problem Language Result Execution time Memory
775673 2023-07-06T18:20:37 Z LeaRouse Table Tennis (info1cup20_tabletennis) C++14
9 / 100
3000 ms 224684 KB
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(0); cin.tie(0);
#define ff first
#define ss second
#define ll long long
using namespace std;
const int MAX=2e5+5;
const ll INF=1e10;
int A[MAX];
int n,k;;
unordered_map<int,int>m;
vector<int>v;
bool res(int suma){
	int ans=0;
	for(int i=0;i<n+k;i++){
		if(!m[A[i]] or ans==n/2)	continue;
		if(A[i]>suma)	continue;
		if(m[suma-A[i]]){
			m[suma-A[i]]--;
			m[A[i]]--;
			ans++;
			v.push_back(A[i]);
			v.push_back(suma-A[i]);
		}	
	}
	if(ans==n/2)	return true;
	else 	return false;
}

void go(){
		cin>>n>>k;
	for(int i=0;i<(n+k);i++){
		cin>>A[i];
		m[A[i]]++;
	}
	sort(A,A+n);
	for(int i=0;i<=k;i++){
		for(int j=0;j<=k;j++){
			int suma=A[i]+A[n-1-j];
			if(res(suma)){
				sort(v.begin(),v.end());
				for(auto it:v)	cout<<it<<" ";
				break;
			}
			else	v.clear();
		}
	}

}
 
int main(){
	fastio;
	go();
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 596 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 1596 KB Output not subsequence of input
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 350 ms 40316 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 27 ms 5396 KB Output is correct
2 Incorrect 56 ms 13052 KB Unexpected end of file - int32 expected
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Incorrect 14 ms 1712 KB Unexpected end of file - int32 expected
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Execution timed out 3062 ms 224684 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3056 ms 200860 KB Time limit exceeded
2 Halted 0 ms 0 KB -