# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
373235 | 2021-03-03T22:01:38 Z | ahmedfouadnew | Table Tennis (info1cup20_tabletennis) | C++17 | 3000 ms | 120152 KB |
#include<bits/stdc++.h> using namespace std; #define s second #define f first #define pb push_back //#define int long long //#define double long double int n,k; int a[200005]; unordered_map<int,int>mp; int mx,mxi; void fun(int ii,int s,int e) { e=min(e,n+k-1); s=max(0,s); for(int i=s;i<=e;i++) { if(i==ii) continue; mp[a[ii]+a[i]]++; if(mp[a[ii]+a[i]]>mx) { mx=mp[a[ii]+a[i]]; mxi=a[ii]+a[i]; } } } signed main() { scanf("%d%d",&n,&k); for(int i=0;i<n+k;i++) { scanf("%d",a+i); } sort(a,a+n+k); for(int i=0;i<(n+k)/2;i++) { fun(i,(n+k-1-i)-k-1,(n+k-1-i)+k+1); } vector<int>ans; int cnt=n; int e=n+k-1; for(int i=0;i<n+k;i++) { int cur=e; bool ok=0; while(e-cur<=k) { if(a[i]+a[cur]==mxi) { ok=1; ans.pb(a[i]); ans.pb(a[cur]); break; } cur--; } if(ok) { cnt-=2; e=cur-1; } if(cnt==0) break; } sort(ans.begin(),ans.end()); for(int i=0;i<ans.size();i++) { if(i) printf(" "); printf("%d",ans[i]); } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 7 ms | 364 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 70 ms | 3296 KB | Output is correct |
2 | Correct | 74 ms | 3688 KB | Output is correct |
3 | Correct | 68 ms | 3168 KB | Output is correct |
4 | Correct | 69 ms | 3560 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 620 KB | Output is correct |
2 | Incorrect | 3 ms | 748 KB | Unexpected end of file - int32 expected |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 396 KB | Output is correct |
2 | Incorrect | 3 ms | 364 KB | Output not subsequence of input |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 592 ms | 12452 KB | Output is correct |
3 | Correct | 245 ms | 12084 KB | Output is correct |
4 | Correct | 145 ms | 3444 KB | Output is correct |
5 | Correct | 214 ms | 11316 KB | Output is correct |
6 | Incorrect | 124 ms | 876 KB | Unexpected end of file - int32 expected |
7 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 16 ms | 3704 KB | Output is correct |
2 | Execution timed out | 3070 ms | 120152 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |