# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
423643 | 2021-06-11T10:50:28 Z | jamezzz | Table Tennis (info1cup20_tabletennis) | C++17 | 3000 ms | 10100 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; unordered_set<int> in; int main(){ sf("%d%d",&n,&k); n+=k; for(int i=0;i<n;++i){ sf("%d",&v); s.push_back(v); in.insert(v); } sort(all(s)); int res=0,l,r; for(int i=0;i<=k;++i){ if(i!=0)in.erase(s[i-1]); for(int j=n-(k-i)-1;j<n;++j)in.erase(s[j]); for(int j=n-(k-i)-1;j<n;++j){ in.insert(s[j]); int t=s[i]+s[j],take=1; for(int l=i+1;l<j;++l){ if(s[l]>=t-s[l])break; if(!in.count(s[l]))continue; if(in.count(t-s[l])){ ++take; } if(take==(n-k)/2)break; } if(take==(n-k)/2){ res=t; l=i;r=j; break; } } if(res!=0)break; } in.clear(); for(int i=l+1;i<r;++i)in.insert(s[i]); ans.pb(s[l]);ans.pb(s[r]); for(int i=l+1;i<r;++i){ if(s[i]>=res-s[i])break; if(!in.count(s[i]))continue; if(in.count(res-s[i])){ ans.pb(s[i]); ans.pb(res-s[i]); } if(ans.size()==n-k)break; } sort(all(ans)); for(int x:ans)pf("%d ",x); pf("\n"); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 332 KB | Output is correct |
2 | Correct | 2 ms | 332 KB | Output is correct |
3 | Correct | 2 ms | 332 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 1568 KB | Output is correct |
2 | Correct | 140 ms | 9932 KB | Output is correct |
3 | Correct | 137 ms | 9900 KB | Output is correct |
4 | Correct | 124 ms | 9952 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 137 ms | 9900 KB | Output is correct |
2 | Correct | 136 ms | 9912 KB | Output is correct |
3 | Correct | 186 ms | 9992 KB | Output is correct |
4 | Correct | 118 ms | 9992 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 26 ms | 248 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 17 ms | 300 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 12 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 332 KB | Output is correct |
4 | Correct | 15 ms | 380 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 | 0 ms | 204 KB | Output is correct |
2 | Correct | 2116 ms | 9956 KB | Output is correct |
3 | Correct | 172 ms | 10000 KB | Output is correct |
4 | Correct | 1197 ms | 9960 KB | Output is correct |
5 | Correct | 224 ms | 10100 KB | Output is correct |
6 | Correct | 98 ms | 9944 KB | Output is correct |
7 | Correct | 1341 ms | 9992 KB | Output is correct |
8 | Correct | 258 ms | 9996 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Execution timed out | 3052 ms | 6908 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |