답안 #1092381

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1092381 2024-09-24T00:36:27 Z Saul0906 사육제 (CEOI14_carnival) C++14
0 / 100
1 ms 344 KB
#include <bits/stdc++.h>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fi first
#define se second
//#define endl "\n"
#define rep(a,b,c) for(ll a=b; a<c; a++)
#define rep2(a,b,c,d) for(ll a=b; a<c; a+=d)
#define repr(a,b,c) for(ll a=b-1; a>c-1; a--)
#define repa(a,b) for(const auto &a: b)
#define multicase() int t; cin>>t; while(t--)
#define fastIO() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define valid(c) cout<<(c ? "YES" : "NO")<<endl;
#define valid2(c,a,b) cout<<(c ? a : b)<<endl;
#define ll long long 
#define pq_min(a) priority_queue<a, vector<a>, greater<a>>
#define pq_max(a) priority_queue<a>
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define mid ((l+r)>>1)
#define flush endl<<flush;

using namespace std;

int query(int l, int r, int z=0){
	cout<<r-l+(z>0);
	rep(i,l,r+1) cout<<" "<<i;
	if(z) cout<<" "<<z;
	cout<<endl;
	cin>>l;
	return l;
}

bool ask(int l, int r, int z){
	int x=query(l,r), y=query(l,r,z);
	return x==y;
}

int main(){
	fastIO();
	int n;
	cin>>n;
	int a[n+1]{}, c=1, l, r;
	a[1]=1;
	rep(i,2,n+1){
		l=1, r=i-1;
		if(!ask(l,r,i)){
			a[i]=++c;
			continue;
		}
		while(l<r){
			if(ask(l,mid,i)) r=mid;
			else l=mid+1;
		}
		a[i]=a[l];
	}
	rep(i,0,n+1) cout<<a[i]<<" ";
	cout<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1 ms 344 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 0 ms 344 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1 ms 344 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1 ms 344 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 0 ms 344 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -