# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
424448 | 2021-06-12T00:42:37 Z | jamezzz | Table Tennis (info1cup20_tabletennis) | C++17 | 3000 ms | 4540 KB |
#include <bits/stdc++.h> using namespace std; #define sf scanf #define pf printf #define pb emplace_back #define all(x) x.begin(),x.end() int n,k,v; vector<int> s,ans; 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)); int res=0,l,r; for(int i=0;i<=k;++i){ for(int j=n-(k-i)-1;j<n;++j){ int t=s[i]+s[j],take=1; int cr=j-1; for(int l=i+1;l<j;++l){ if(s[l]>=t-s[l])break; while(t-s[l]<s[cr])--cr; if(t-s[l]==s[cr])++take,--cr; if(take==(n-k)/2)break; } if(take==(n-k)/2){ res=t; l=i;r=j; break; } } if(res!=0)break; } ans.pb(s[l]);ans.pb(s[r]); int cr=r-1; for(int i=l+1;i<r;++i){ if(s[i]>=res-s[i])break; while(res-s[i]<s[cr])--cr; if(res-s[i]==s[cr]){ ans.pb(s[i]); ans.pb(res-s[i]); --cr; } if(ans.size()==n-k)break; } sort(all(ans)); for(int x:ans)pf("%d ",x); pf("\n"); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 332 KB | Output is correct |
2 | Correct | 1 ms | 332 KB | Output is correct |
3 | Correct | 1 ms | 332 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 972 KB | Output is correct |
2 | Correct | 49 ms | 4476 KB | Output is correct |
3 | Correct | 47 ms | 4452 KB | Output is correct |
4 | Correct | 54 ms | 4412 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 48 ms | 4388 KB | Output is correct |
2 | Correct | 53 ms | 4472 KB | Output is correct |
3 | Correct | 50 ms | 4540 KB | Output is correct |
4 | Correct | 47 ms | 4484 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 2 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 2 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 332 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 0 ms | 204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 2 ms | 332 KB | Output is correct |
3 | Correct | 1 ms | 332 KB | Output is correct |
4 | Correct | 2 ms | 332 KB | Output is correct |
5 | Correct | 1 ms | 332 KB | Output is correct |
6 | Correct | 1 ms | 332 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 200 ms | 4520 KB | Output is correct |
3 | Correct | 62 ms | 4408 KB | Output is correct |
4 | Correct | 84 ms | 4480 KB | Output is correct |
5 | Correct | 50 ms | 4452 KB | Output is correct |
6 | Correct | 53 ms | 4536 KB | Output is correct |
7 | Correct | 83 ms | 4500 KB | Output is correct |
8 | Correct | 50 ms | 4428 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Execution timed out | 3071 ms | 1968 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |