# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
523370 | 2022-02-07T14:50:35 Z | Ahmed2me | Table Tennis (info1cup20_tabletennis) | C++17 | 1 ms | 460 KB |
#include <bits/stdc++.h> using namespace std; long long t=1,n,m,a[200020]; bool good(long long sum) { long long i=1,j=n+m; long long cnt=false; while(i<j) { if(a[i]+a[j]==sum){cnt++;i++;j--;continue;} if(a[i]+a[j]>sum){j--;continue;} if(a[i]+a[j]<sum){i++;continue;} } return cnt>=(n/2); } void print_ans(long long sum) { long long i=1;long long j=n+m; vector<long long>ans; long long counter=false; while(i<j) { if(counter>=(n/2)){break;} if(a[i]+a[j]==sum){counter++;ans.push_back(a[i]);ans.push_back(a[j]);i++;j--;continue;} if(a[i]+a[j]>sum){j--;continue;} if(a[i]+a[j]<sum){i++;continue;} } sort(ans.begin(),ans.end()); for(int i=0;i<ans.size();i++){cout<<ans[i]<<' ';} return; } void solve() { scanf("%d%d",n,m);map<long long,bool>mp; for(int i=1;i<=n+m;i++){cin>>a[i];} for(int i=1;i<=min(n,2*m);i++) { for(int j=max(1ll,(n-m+1));j<=n+m;j++) { mp[(a[i]+a[j])]=true; } } for(auto I:mp){if(good(I.first)){print_ans(I.first);return;}} } int main() { ios::sync_with_stdio(NULL);cin.tie(NULL);cout.tie(NULL); while(t--){solve();}return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 460 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 460 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 460 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 460 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 460 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 404 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 460 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 460 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |