#include<bits/stdc++.h>
// #pragma GCC target ("avx,avx2,fma")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
typedef long long ll;
typedef long double ld;
#define SPEED ios_base::sync_with_stdio(false); cin.tie(0), cout.tie(0)
#define rall(v) (v).rbegin(),(v).rend()
#define all(v) (v).begin(),(v).end()
#define OK cerr<<"OK"<<endl<<flush
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define F first
#define S second
#define y0 jahdakdh
#define y1 jahsadakdakdh
#define endl '\n'
using namespace std;
const ll MOD=1e9+7;
// mt19937 rng(std::chrono::system_clock::now().time_since_epoch().count());
int n, a[155], mx=1, d[155][155], q;
set<int>s;
void ask(int l, int r, int k)
{
//cout<<l<<' '<<r<<' '<<k<<endl;
cout<<r-l+2;
for(int i=l; i<=r; i++)
cout<<' '<<i;
cout<<' '<<k<<endl<<flush;
cin>>q;
}
void cal(int l, int r)
{
if(d[l][r]) return;
s.clear();
for(int i=l; i<=r; i++)
s.insert(a[i]);
d[l][r]=s.size();
}
int main()
{
SPEED;
cin>>n;
a[1]=1; d[1][1]=1;
for(int i=2; i<=n; i++)
{
int mid, l=1, r=i-1;
ask(l, r, i);
cal(l, r);
if(q==d[l][r]+1)
{
a[i]=++mx;
continue;
}
while(l<r)
{
mid=(l+r)>>1;
ask(l, mid, i);
cal(l, mid);
if(q==d[l][mid]+1)
l=mid+1;
else r=mid;
}
a[i]=a[l];
}
for(int i=0; i<=n; i++)
cout<<a[i]<<' ';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
328 KB |
Output is correct |
2 |
Correct |
11 ms |
328 KB |
Output is correct |
3 |
Correct |
7 ms |
328 KB |
Output is correct |
4 |
Correct |
5 ms |
328 KB |
Output is correct |
5 |
Correct |
11 ms |
200 KB |
Output is correct |
6 |
Correct |
11 ms |
200 KB |
Output is correct |
7 |
Correct |
11 ms |
328 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
16 ms |
200 KB |
Output is correct |
2 |
Correct |
13 ms |
348 KB |
Output is correct |
3 |
Correct |
6 ms |
328 KB |
Output is correct |
4 |
Correct |
5 ms |
328 KB |
Output is correct |
5 |
Correct |
12 ms |
200 KB |
Output is correct |
6 |
Correct |
9 ms |
200 KB |
Output is correct |
7 |
Correct |
13 ms |
200 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
13 ms |
200 KB |
Output is correct |
2 |
Correct |
13 ms |
200 KB |
Output is correct |
3 |
Correct |
11 ms |
328 KB |
Output is correct |
4 |
Correct |
3 ms |
316 KB |
Output is correct |
5 |
Correct |
9 ms |
200 KB |
Output is correct |
6 |
Correct |
12 ms |
200 KB |
Output is correct |
7 |
Correct |
15 ms |
356 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
13 ms |
200 KB |
Output is correct |
2 |
Correct |
16 ms |
200 KB |
Output is correct |
3 |
Correct |
7 ms |
328 KB |
Output is correct |
4 |
Correct |
5 ms |
328 KB |
Output is correct |
5 |
Correct |
12 ms |
200 KB |
Output is correct |
6 |
Correct |
9 ms |
320 KB |
Output is correct |
7 |
Correct |
9 ms |
328 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
17 ms |
200 KB |
Output is correct |
2 |
Correct |
14 ms |
328 KB |
Output is correct |
3 |
Correct |
9 ms |
328 KB |
Output is correct |
4 |
Correct |
8 ms |
328 KB |
Output is correct |
5 |
Correct |
7 ms |
200 KB |
Output is correct |
6 |
Correct |
7 ms |
200 KB |
Output is correct |
7 |
Correct |
3 ms |
320 KB |
Output is correct |