# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
245682 | 2020-07-07T07:03:07 Z | nnnnnnnnnnnnnnnn | 사육제 (CEOI14_carnival) | C++17 | 18 ms | 512 KB |
#include<bits/stdc++.h> using namespace std; typedef long long int ll; typedef vector<int> vi; typedef pair<int,int> ii; int main() { int n,i,j,k; cin >> n; int res[n+1]; for(i=0;i<=n;++i) res[i]=0; vector<vi> grp; grp.assign(n+1,vi()); grp[1].push_back(1); int total_grp = 1; res[1] = 1; for(i=2;i<=n;++i) { vi ask; int l=1,r=total_grp,rep,ans; ask.push_back(i); for(j=l;j<=r;j++) { for(auto k:grp[j]) { ask.push_back(k); } } cout<<ask.size()<<" "; for(auto j:ask) { cout<<j<<" "; } cout<<endl; cin>>rep; ask.clear(); if(rep > r-l+1) { total_grp++; res[i] = total_grp; grp[total_grp].push_back(i); } else { while(l<=r) { int mid = (l+r)/2; ask.push_back(i); for(j=l;j<=mid;j++) { for(auto k:grp[j]) { ask.push_back(k); } } // printf("a %d %d\n",l,mid); cout<<ask.size()<<" "; for(auto j:ask) cout<<j<<" "; cout<<endl; cin>>rep; ask.clear(); if(rep == mid-l+1) { if(mid-l+1==1) { ans = l; break; } r = mid; } else { l = mid+1; } } res[i] = ans; grp[ans].push_back(i); } } cout<<0<<" "; for(i=1;i<=n;++i) cout<<res[i]<<" "; cout<<endl; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 256 KB | Output is correct |
2 | Correct | 12 ms | 384 KB | Output is correct |
3 | Correct | 9 ms | 512 KB | Output is correct |
4 | Correct | 8 ms | 384 KB | Output is correct |
5 | Correct | 11 ms | 384 KB | Output is correct |
6 | Correct | 8 ms | 380 KB | Output is correct |
7 | Correct | 12 ms | 256 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 380 KB | Output is correct |
2 | Correct | 14 ms | 256 KB | Output is correct |
3 | Correct | 8 ms | 384 KB | Output is correct |
4 | Correct | 9 ms | 256 KB | Output is correct |
5 | Correct | 14 ms | 256 KB | Output is correct |
6 | Correct | 14 ms | 376 KB | Output is correct |
7 | Correct | 13 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 256 KB | Output is correct |
2 | Correct | 14 ms | 384 KB | Output is correct |
3 | Correct | 16 ms | 384 KB | Output is correct |
4 | Correct | 8 ms | 384 KB | Output is correct |
5 | Correct | 17 ms | 376 KB | Output is correct |
6 | Correct | 13 ms | 384 KB | Output is correct |
7 | Correct | 15 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 256 KB | Output is correct |
2 | Correct | 12 ms | 384 KB | Output is correct |
3 | Correct | 9 ms | 256 KB | Output is correct |
4 | Correct | 7 ms | 384 KB | Output is correct |
5 | Correct | 18 ms | 256 KB | Output is correct |
6 | Correct | 16 ms | 256 KB | Output is correct |
7 | Correct | 13 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 256 KB | Output is correct |
2 | Correct | 14 ms | 256 KB | Output is correct |
3 | Correct | 14 ms | 384 KB | Output is correct |
4 | Correct | 11 ms | 256 KB | Output is correct |
5 | Correct | 14 ms | 384 KB | Output is correct |
6 | Correct | 11 ms | 384 KB | Output is correct |
7 | Correct | 8 ms | 256 KB | Output is correct |