Submission #775690

# Submission time Handle Problem Language Result Execution time Memory
775690 2023-07-06T18:50:38 Z HD1 Table Tennis (info1cup20_tabletennis) C++14
72 / 100
702 ms 12680 KB
//we are all lost trying to be someone.
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(0); cin.tie(0);
#define sz(x) ll(x.size())
#define reve(x) reverse(x.begin(),x.end())
#define ff first
#define ss second
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> ii;
const ll MAX=3*(1e5+100);
const ll mod=1e9+7;
const ll inf=1e18+7;
ll A[MAX], s[1610];
unordered_map<ll,ll> M,N;
vector<ll >c;
int main(){
	ll n, k;
	cin>>n>>k;
	for(ll i=0; i<n+k; i++){
		cin>>A[i];
		M[A[i]]++;
	}
	sort(A,A+n+k);
	ll cont=0;
	for(ll i=0; i<k+1; i++){
		for(ll j=n+k-1; j>=n-1; j--){
			s[cont]=A[i]+A[j];
			cont++;
		}
	}
	bool xd=false;
	for(ll i=0; i<cont; i++){
		for(ll j=0; j<n+k and A[j]<s[i]/2; j++){
			ll x=s[i]-A[j];
			if(M.count(x)){
				c.push_back(A[j]);
				c.push_back(x);
				if(sz(c)>=n){
					xd=true;
					break;
				}
			}
		}
		if(xd) break;
		c.clear();
	}
	sort(c.begin(),c.end());
	for(ll i=0; i<sz(c); i++){
		cout<<c[i]<<" ";
	}
	cout<<'\n';
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 1732 KB Output is correct
2 Correct 84 ms 11200 KB Output is correct
3 Correct 84 ms 11104 KB Output is correct
4 Correct 88 ms 11220 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 88 ms 11160 KB Output is correct
2 Correct 85 ms 11176 KB Output is correct
3 Correct 93 ms 11188 KB Output is correct
4 Correct 101 ms 11248 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 340 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 6 ms 408 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 6 ms 340 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
6 Correct 1 ms 396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 702 ms 11264 KB Output is correct
3 Correct 133 ms 12600 KB Output is correct
4 Correct 381 ms 12544 KB Output is correct
5 Correct 104 ms 12540 KB Output is correct
6 Correct 86 ms 12680 KB Output is correct
7 Correct 390 ms 12584 KB Output is correct
8 Correct 90 ms 12660 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 137 ms 1564 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -