# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
424457 | 2021-06-12T01:04:38 Z | jamezzz | Table Tennis (info1cup20_tabletennis) | C++17 | 54 ms | 4512 KB |
#include <bits/stdc++.h> using namespace std; #define sf scanf #define pf printf #define fi first #define se second #define pb emplace_back #define all(x) x.begin(),x.end() int n,k,v; vector<int> s,ans; map<int,int> cnt; int main(){ sf("%d%d",&n,&k); n+=k; for(int i=0;i<n;++i){ sf("%d",&v); s.push_back(v); } sort(all(s)); for(int i=0;i<min(2*k,n);++i){ for(int j=max(0,n-2*k);j<n;++j){ if(i==j)continue; cnt[s[i]+s[j]]+=1; } } for(auto it:cnt){ if(it.se>=k){ ans.clear(); int cr=n-1; for(int i=0;i<n;++i){ if(s[i]>=it.fi-s[i])break; while(it.fi-s[i]<s[cr])--cr; if(it.fi-s[i]==s[cr]){ ans.pb(s[i]); ans.pb(it.fi-s[i]); --cr; } if(ans.size()==n-k)break; } if(ans.size()==n-k)break; } } sort(all(ans)); for(int x:ans)pf("%d ",x); pf("\n"); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 332 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 716 KB | Output is correct |
2 | Correct | 50 ms | 3004 KB | Output is correct |
3 | Correct | 54 ms | 3056 KB | Output is correct |
4 | Correct | 50 ms | 3052 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 50 ms | 3056 KB | Output is correct |
2 | Correct | 48 ms | 3032 KB | Output is correct |
3 | Correct | 53 ms | 3000 KB | Output is correct |
4 | Correct | 47 ms | 2988 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 716 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Incorrect | 0 ms | 204 KB | Unexpected end of file - int32 expected |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 38 ms | 4512 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |