#include <bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
ll inf =1e12;
const ll mx=155;
ll arr[mx];
vector<ll>v[155];
ll vis[mx+1];
ll c=0;
ll n;
ll k;
void dfs(ll x)
{
vis[x]=c;
for(auto u:v[x])
if(!vis[u])dfs(u);
}
ll call (ll l,ll r)
{
k=0;
for(int i=l;i<=r;i++)if(arr[i]==0)k++;
if(k==1)return 1;
if(l==r)return k;
cout<<k<<' ';
for(int i=l;i<=r;i++)
if(arr[i]==0)
cout<<i<<' ';
cout<<endl;
ll x;
cin>>x;
return x;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cin>>n;
ll l=1,r=2;
while(r<=n)
{
ll ans=call(l,r);
if(ans!=k)
{
ll le=l+1,ri=r;
ll les=l;
while(le<ri)
{
//cout<<'*'<<' '<<le<<' '<<ri<<endl;
ll ans=call(le,ri);
if(ans==k)break;
les=le;
le++;
while(arr[le]==1)le++;
//cout<<'*'<<' '<<le<<' '<<les<<endl;
}
v[les].push_back(r);
arr[les]=1;
//cout<<endl;
}
r++;
while(arr[l]==1)l++;
}
//--------------
for(int i=1;i<=n;i++)
{
if(vis[i]==0)
{
c++;
dfs(i);
}
}
cout<<0<<' ';
for(int i=1;i<=n;i++)cout<<vis[i]<<' ';
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
208 KB |
Output is correct |
2 |
Correct |
18 ms |
208 KB |
Output is correct |
3 |
Correct |
15 ms |
208 KB |
Output is correct |
4 |
Correct |
6 ms |
208 KB |
Output is correct |
5 |
Correct |
4 ms |
208 KB |
Output is correct |
6 |
Correct |
5 ms |
208 KB |
Output is correct |
7 |
Correct |
17 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
208 KB |
Output is correct |
2 |
Correct |
17 ms |
208 KB |
Output is correct |
3 |
Correct |
7 ms |
208 KB |
Output is correct |
4 |
Correct |
9 ms |
208 KB |
Output is correct |
5 |
Correct |
10 ms |
208 KB |
Output is correct |
6 |
Correct |
13 ms |
328 KB |
Output is correct |
7 |
Correct |
10 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
208 KB |
Output is correct |
2 |
Correct |
9 ms |
320 KB |
Output is correct |
3 |
Correct |
27 ms |
308 KB |
Output is correct |
4 |
Correct |
6 ms |
208 KB |
Output is correct |
5 |
Correct |
17 ms |
320 KB |
Output is correct |
6 |
Correct |
22 ms |
208 KB |
Output is correct |
7 |
Correct |
24 ms |
308 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
208 KB |
Output is correct |
2 |
Correct |
7 ms |
208 KB |
Output is correct |
3 |
Correct |
19 ms |
208 KB |
Output is correct |
4 |
Correct |
6 ms |
208 KB |
Output is correct |
5 |
Correct |
28 ms |
208 KB |
Output is correct |
6 |
Correct |
26 ms |
304 KB |
Output is correct |
7 |
Correct |
24 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
208 KB |
Output is correct |
2 |
Correct |
15 ms |
208 KB |
Output is correct |
3 |
Correct |
17 ms |
208 KB |
Output is correct |
4 |
Correct |
24 ms |
208 KB |
Output is correct |
5 |
Correct |
31 ms |
308 KB |
Output is correct |
6 |
Correct |
24 ms |
208 KB |
Output is correct |
7 |
Correct |
14 ms |
208 KB |
Output is correct |