This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define sqr 500
//#define mp make_pair
#define mid (l+r)/2
#define le node * 2
#define ri node * 2 + 1
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define ins insert
#define era erase
#define C continue
#define mem(dp,i) memset(dp,i,sizeof(dp))
#define mset multiset
#define all(x) x.begin(), x.end()
typedef long long ll;
typedef short int si;
typedef double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
typedef pair<double,ll>pdi;
const ll inf=1e18;
const ll mod=1e9+7;
const ld Pi=acos(-1);
const ll Mx = 2e5+9 ;
int n ;
int a [209] ;
vi v [209] , ret ;
int query (vi v) {
if ( v .size () == 1 ) return 1 ;
cout << v .size () << " " ;
for ( auto u : v ) cout << u << " " ;
cout << endl ;
int x ;
cin >> x ;
return x ;
}
int build ( int l , int r , int more ) {
vi v ;
for ( int i = l ; i<= r ; i ++ ) v .pb (ret[i]) ;
v .pb (more) ;
return query(v) ;
}
int main () {
cin >> n ;
for ( int i = 1 ; i <= n ; i ++ ) {
ret .pb (i) ;
int x = query (ret) ;
if ( x == ret .size () ) {
v [i] .pb (i) ;
continue ;
}
ret .pop_back () ;
int l = -1 , r = ret .size () -1;
while ( r - l > 1 ) {
if ( build (0,mid,i) == mid + 2 ) l = mid ;
else r = mid ;
}
v [ret[r]] .pb (i) ;
}
//
int timer = 1 ;
for ( int i = 1 ; i <= n ; i ++ ) {
if ( v [i] .size () ) {
for ( auto u : v [i] ) {
a [u] = timer ;
}
timer ++ ;
}
}
cout << 0 << " " ;
for ( int i = 1 ; i <= n ; i ++ ) cout << a [i] << " " ;
cout << endl ;
}
Compilation message (stderr)
carnival.cpp: In function 'int main()':
carnival.cpp:57:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
57 | if ( x == ret .size () ) {
| ~~^~~~~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |