# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
373390 | 2021-03-04T12:08:17 Z | ahmedfouadnew | Table Tennis (info1cup20_tabletennis) | C++17 | 3000 ms | 126256 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; unordered_map<int,int>mp2; int mx,mxi; bool okk; void fun(int ii,int s,int e) { if(okk) return; 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]; } if(mp[a[ii]+a[i]]>=n) { okk=1; break; } } } signed main() { scanf("%d%d",&n,&k); for(int i=0;i<n+k;i++) { scanf("%d",a+i); mp2[a[i]]=1; } sort(a,a+n+k); for(int i=0;i<n+1&&!okk;i++) { fun(i,(n+k-1-i)-k-1,(n+k-1-i)+k+1); } vector<int>ans; int cnt=n; for(int i=0;i<n+k;i++) { if(mp2[mxi-a[i]]) { cnt-=2; ans.pb(a[i]); ans.pb(mxi-a[i]); } 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 | 2 ms | 492 KB | Output is correct |
2 | Correct | 2 ms | 492 KB | Output is correct |
3 | Correct | 2 ms | 492 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 19 ms | 1644 KB | Output is correct |
2 | Correct | 150 ms | 11828 KB | Output is correct |
3 | Correct | 160 ms | 11700 KB | Output is correct |
4 | Correct | 143 ms | 11828 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 157 ms | 10676 KB | Output is correct |
2 | Correct | 165 ms | 11188 KB | Output is correct |
3 | Correct | 162 ms | 10716 KB | Output is correct |
4 | Correct | 144 ms | 11188 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 492 KB | Output is correct |
2 | Incorrect | 4 ms | 876 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 | 364 KB | Output is correct |
2 | Correct | 6 ms | 492 KB | Output is correct |
3 | Correct | 12 ms | 2156 KB | Output is correct |
4 | Correct | 8 ms | 620 KB | Output is correct |
5 | Correct | 6 ms | 492 KB | Output is correct |
6 | Incorrect | 5 ms | 492 KB | Output not subsequence of input |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1143 ms | 18844 KB | Output is correct |
3 | Correct | 521 ms | 18740 KB | Output is correct |
4 | Correct | 383 ms | 10932 KB | Output is correct |
5 | Correct | 441 ms | 18100 KB | Output is correct |
6 | Incorrect | 377 ms | 10804 KB | Output not subsequence of input |
7 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 876 KB | Output is correct |
2 | Execution timed out | 3104 ms | 126256 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |