# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
216187 | 2020-03-26T21:25:31 Z | Pajaraja | Table Tennis (info1cup20_tabletennis) | C++17 | 46 ms | 4012 KB |
#include <bits/stdc++.h> #define MAXN 200007 #define MAXK 407 using namespace std; int a[MAXN],n,k,m; mt19937 rng(time(NULL)); bool check(int s) { int t1=1,t2=m; vector<pair<int,int> > p; while(t1<t2) { if(a[t1]+a[t2]==s) p.push_back({t1,t2}); if(a[t1]+a[t2]<=s) t1++; if(a[t1]+a[t2]>s) t2--; } if(p.size()<n/2) return false; for(int i=0;i<n/2;i++) printf("%d ",p[i].first); for(int i=n/2-1;i>=0;i--) printf("%d ",p[i].second); return true; } int main() { scanf("%d%d",&n,&k); m=n+k; for(int i=1;i<=m;i++) scanf("%d",&a[i]); if(n>k) { bool found=false; while(!found) { int x=rng()%m+1; for(int i=max(m+1-x-k,1);i<=min(m+1-x+k,m) && !found;i++) found=check(a[i]+a[x]); } } else { bool found=false; for(int i=1;i<=k+1 && !found;i++) for(int j=m;j>=m-k-1 && !found;j--) found=check(a[i]+a[j]); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 256 KB | Output not subsequence of input |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 9 ms | 944 KB | Output not subsequence of input |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 46 ms | 4012 KB | Output not subsequence of input |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 384 KB | Output not subsequence of input |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 384 KB | Output not subsequence of input |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 384 KB | Output not subsequence of input |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 384 KB | Output not subsequence of input |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 384 KB | Output not subsequence of input |
2 | Halted | 0 ms | 0 KB | - |