답안 #377505

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
377505 2021-03-14T09:25:25 Z YJU 사육제 (CEOI14_carnival) C++14
100 / 100
10 ms 512 KB
#include<bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector,Ofast")
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
const ll MOD=1e9+7;
const ll MOD2=998244353;
const ll N=2e5+5;
const ld pi=acos(-1);
const ll INF=(1LL<<60);
#define SQ(i) ((i)*(i))
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define setp setprecision
#define lwb lower_bound
#define SZ(_a) (ll)_a.size()

ll ans[N],n,c[N],cnt=1;

ll ck(ll range,ll id){
	cout<<range+1<<endl;
	REP1(i,range)cout<<c[i]<<" ";
	cout<<id<<endl;
	ll tmp;
	cin>>tmp;
	return tmp;
}

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin>>n;
	REP1(i,n){
		if(i==1){ans[i]=1;c[1]=i;continue;}
		ll l=0,r=cnt;
		if(ck(r,i)!=r){ans[i]=r+1;c[r+1]=i;++cnt;continue;}
		while(r-l>1){
			ll mid=(l+r)>>1;
			if(ck(mid,i)==mid){
				r=mid;
			}else{
				l=mid;
			}
		}
		ans[i]=r;c[r]=i;
	}
	cout<<"0";
	REP1(i,n)cout<<" "<<ans[i];
	cout<<endl<<"\n";
	return 0;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 364 KB Output is correct
2 Correct 8 ms 364 KB Output is correct
3 Correct 6 ms 364 KB Output is correct
4 Correct 3 ms 364 KB Output is correct
5 Correct 2 ms 364 KB Output is correct
6 Correct 3 ms 364 KB Output is correct
7 Correct 8 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 364 KB Output is correct
2 Correct 10 ms 364 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 3 ms 364 KB Output is correct
5 Correct 3 ms 364 KB Output is correct
6 Correct 5 ms 512 KB Output is correct
7 Correct 6 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 364 KB Output is correct
2 Correct 4 ms 364 KB Output is correct
3 Correct 8 ms 364 KB Output is correct
4 Correct 4 ms 364 KB Output is correct
5 Correct 5 ms 364 KB Output is correct
6 Correct 5 ms 364 KB Output is correct
7 Correct 8 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 364 KB Output is correct
2 Correct 5 ms 364 KB Output is correct
3 Correct 8 ms 364 KB Output is correct
4 Correct 5 ms 364 KB Output is correct
5 Correct 6 ms 364 KB Output is correct
6 Correct 6 ms 364 KB Output is correct
7 Correct 7 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 364 KB Output is correct
2 Correct 7 ms 364 KB Output is correct
3 Correct 9 ms 364 KB Output is correct
4 Correct 7 ms 364 KB Output is correct
5 Correct 8 ms 364 KB Output is correct
6 Correct 5 ms 364 KB Output is correct
7 Correct 4 ms 364 KB Output is correct