Submission #1092380

# Submission time Handle Problem Language Result Execution time Memory
1092380 2024-09-24T00:34:46 Z vjudge1 Carnival (CEOI14_carnival) C++17
0 / 100
1 ms 600 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+1;
	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;
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 344 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 344 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 600 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -