Submission #775678

#TimeUsernameProblemLanguageResultExecution timeMemory
775678LeaRouseTable Tennis (info1cup20_tabletennis)C++14
72 / 100
3077 ms206940 KiB
#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]] || ans==n/2) continue; if(A[i]>suma/2) continue; if(m[suma-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+k); for(int i=0;i<=k;i++){ for(int j=0;j<=k;j++){ int suma=A[i]+A[n+k-1-j]; if(res(suma)){ sort(v.begin(),v.end()); for(auto it:v) cout<<it<<" "; cout << endl; break; } else v.clear(); } if(v.size()) break; } } int main(){ fastio; go(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...