# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
366186 | 2021-02-13T13:08:52 Z | Ahmad_Hasan | Table Tennis (info1cup20_tabletennis) | C++17 | 3000 ms | 714908 KB |
#include <bits/stdc++.h> #define int long long /** |||||||||| ||||| ||||| |||||||||| ||||||||||||| ||||| ||||| ||||| |||| |||||| ||||| ||||| ||||| ||||||||||||||||| ||||||||||||||| |||||||||| ||||||||||||||||||| ||||||||||||||| ||||| ||||| ||||| ||||| ||||| ||||| ||||| ||||| ||||| ||||| |||||||||| AHMED;HASSAN;SAEED; */ using namespace std; int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n,k; cin>>n>>k; vector<int>v(n+k); int nn=n+k; for(int i=0;i<nn;i++){ cin>>v[i]; } map<int,int >mp,mp2; vector<vector<pair<int,int> > >pos(nn*(k+5)); int cr=1; for(int i=0;i<nn;i++){ mp2[v[i]]=i+1; for(int j=i+1;j<nn&&(j-i)<=k+5;j++){ if(!mp[v[i]+v[j]])mp[v[i]+v[j]]=cr++; } } int mxi=0; for(map<int,int>::iterator it=mp.begin();it!=mp.end();it++){ for(int i=0;i<nn;i++){ int vl=mp2[(it->first)-v[i]]; if(vl>i+1){ pos[it->second].push_back({i,vl-1}); if(pos[it->second].size()>pos[mxi].size()) mxi=it->second; } } } vector<int>ans; for(int i=0;i<pos[mxi].size()&&i<n/2;i++){ ans.push_back(v[pos[mxi][i].first]); ans.push_back(v[pos[mxi][i].second]); } sort(ans.begin(),ans.end()); for(int i=0;i<n;i++) cout<<ans[i]<<' '; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3081 ms | 159664 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3052 ms | 24904 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3123 ms | 714908 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 742 ms | 66796 KB | Output is correct |
2 | Correct | 512 ms | 50284 KB | Output is correct |
3 | Correct | 1102 ms | 101100 KB | Output is correct |
4 | Correct | 614 ms | 80620 KB | Output is correct |
5 | Correct | 1115 ms | 100844 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 512 KB | Output is correct |
2 | Correct | 1 ms | 492 KB | Output is correct |
3 | Correct | 1 ms | 492 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 1132 KB | Output is correct |
2 | Correct | 1081 ms | 45676 KB | Output is correct |
3 | Execution timed out | 3112 ms | 158956 KB | Time limit exceeded |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 1132 KB | Output is correct |
2 | Execution timed out | 3109 ms | 658428 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3081 ms | 205164 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |