#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> pi;
typedef vector<pi> vpi;
typedef long double ld;
#define pb emplace_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define ALL(x) x.begin(), x.end()
#define SZ(x) (ll)x.size()
#define f first
#define s second
const ll MAXN = 300100;
const ll INF = 1e18;
const ll MOD = 1e9+7;
int out[MAXN],N;
int chk(int s, int e, int v){
int l=(e-s+1);
if(v!=-1)++l;
if(l==1)return 1;
cout<<l<<' ';
for(int i=s;i<=e;++i)cout<<i<<' ';
if(v!=-1)cout<<v<<' ';
cout<<endl;
int t;cin>>t;
return t;
}
int ask(int s, int e, int v){
if(s==e){return out[s];}
int m=(s+e)/2;
if (chk(s,m,v) == chk(s,m,-1))return ask(s,m,v);
else return ask(m+1,e,v);
}
int main(){
//ios_base::sync_with_stdio(0);cin.tie(0);
cin>>N;
out[1]=1;
int l=2;
for(int i=2;i<=N;++i){
if(chk(1,i-1,i) != chk(1,i-1,-1)){
out[i]=l++;
continue;
}
out[i]=ask(1,i-1,i);
}
cout<<0<<' ';for(int i=1;i<=N;++i)cout<<out[i]<<' ';cout<<endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
23 ms |
384 KB |
Output is correct |
2 |
Correct |
20 ms |
256 KB |
Output is correct |
3 |
Correct |
15 ms |
256 KB |
Output is correct |
4 |
Correct |
11 ms |
384 KB |
Output is correct |
5 |
Correct |
25 ms |
384 KB |
Output is correct |
6 |
Correct |
24 ms |
384 KB |
Output is correct |
7 |
Correct |
24 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
23 ms |
256 KB |
Output is correct |
2 |
Correct |
22 ms |
384 KB |
Output is correct |
3 |
Correct |
11 ms |
384 KB |
Output is correct |
4 |
Correct |
12 ms |
384 KB |
Output is correct |
5 |
Correct |
16 ms |
384 KB |
Output is correct |
6 |
Correct |
30 ms |
256 KB |
Output is correct |
7 |
Correct |
24 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
28 ms |
384 KB |
Output is correct |
2 |
Correct |
23 ms |
256 KB |
Output is correct |
3 |
Correct |
20 ms |
256 KB |
Output is correct |
4 |
Correct |
11 ms |
384 KB |
Output is correct |
5 |
Correct |
20 ms |
384 KB |
Output is correct |
6 |
Correct |
26 ms |
256 KB |
Output is correct |
7 |
Correct |
20 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
256 KB |
Output is correct |
2 |
Correct |
25 ms |
256 KB |
Output is correct |
3 |
Correct |
15 ms |
256 KB |
Output is correct |
4 |
Correct |
8 ms |
256 KB |
Output is correct |
5 |
Correct |
26 ms |
384 KB |
Output is correct |
6 |
Correct |
17 ms |
256 KB |
Output is correct |
7 |
Correct |
25 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
30 ms |
384 KB |
Output is correct |
2 |
Correct |
26 ms |
512 KB |
Output is correct |
3 |
Correct |
17 ms |
256 KB |
Output is correct |
4 |
Correct |
17 ms |
256 KB |
Output is correct |
5 |
Correct |
15 ms |
256 KB |
Output is correct |
6 |
Correct |
16 ms |
384 KB |
Output is correct |
7 |
Correct |
12 ms |
384 KB |
Output is correct |