Submission #110513

# Submission time Handle Problem Language Result Execution time Memory
110513 2019-05-11T05:20:48 Z ckodser Carnival (CEOI14_carnival) C++14
100 / 100
25 ms 432 KB
#include<bits/stdc++.h>

#define ll int
#define pb push_back
#define mp make_pair
#define ld long double
#define F first
#define S second
#define pii pair<ll,ll> 

using namespace :: std;

const ll mod=1e9+7;
const ll maxn=200;
const ll inf=1e9+900;


bool is_ther(ll l,ll r,ll x){
    cout<<r-l+1<<' ';;
    for(ll i=l;i<r;i++){
	cout<<i+1<<' ';
    }
    cout<<x+1<<endl;
    ll v;
    cin>>v;


    cout<<r-l<<' ';;
    for(ll i=l;i<r;i++){
	cout<<i+1<<' ';
    }
    ll vv;
    cin>>vv;

    return (v==vv);

}
ll find_val(ll l,ll r,ll x){
    if(!is_ther(l,r,x)){
	return inf;
    }
    while(r-l>1){
	ll mid=(l+r)/2;
	if(is_ther(l,mid,x)){
	    r=mid;
	}else{
	    l=mid;
	}
    }
    return l;
}
vector<ll>  solve(ll n){
    vector<ll> ans;
    ans.pb(1);
    ll cnt=2;
    for(ll i=1;i<n;i++){
	ll u=find_val(0,i,i);
	if(u==inf){
	    ans.pb(cnt);
	    cnt++;
	}else{
	    ans.pb(ans[u]);
	}
    }
    return ans;
}
int main(){
    ll n;
    cin>>n;
    vector<ll> ans=solve(n);
    cout<<0<<' ';
    for(ll i=0;i<n;i++){
	cout<<ans[i]<<' ';
    }
    cout<<endl;
}
# Verdict Execution time Memory Grader output
1 Correct 10 ms 404 KB Output is correct
2 Correct 18 ms 384 KB Output is correct
3 Correct 11 ms 376 KB Output is correct
4 Correct 9 ms 384 KB Output is correct
5 Correct 12 ms 312 KB Output is correct
6 Correct 20 ms 384 KB Output is correct
7 Correct 15 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 20 ms 404 KB Output is correct
2 Correct 22 ms 316 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 7 ms 432 KB Output is correct
5 Correct 11 ms 312 KB Output is correct
6 Correct 10 ms 404 KB Output is correct
7 Correct 20 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 16 ms 384 KB Output is correct
2 Correct 24 ms 256 KB Output is correct
3 Correct 15 ms 256 KB Output is correct
4 Correct 7 ms 256 KB Output is correct
5 Correct 10 ms 408 KB Output is correct
6 Correct 20 ms 256 KB Output is correct
7 Correct 11 ms 328 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 22 ms 384 KB Output is correct
2 Correct 24 ms 424 KB Output is correct
3 Correct 8 ms 376 KB Output is correct
4 Correct 7 ms 324 KB Output is correct
5 Correct 19 ms 412 KB Output is correct
6 Correct 8 ms 412 KB Output is correct
7 Correct 15 ms 312 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 25 ms 384 KB Output is correct
2 Correct 24 ms 384 KB Output is correct
3 Correct 9 ms 408 KB Output is correct
4 Correct 11 ms 384 KB Output is correct
5 Correct 8 ms 320 KB Output is correct
6 Correct 7 ms 320 KB Output is correct
7 Correct 10 ms 256 KB Output is correct