#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;
void dfs(ll x)
{
vis[x]=c;
for(auto u:v[x])
if(!vis[u])dfs(u);
}
ll cnt (ll l,ll r)
{
ll k=0;
for(int i=l;i<=r;i++)if(arr[i]==0)k++;
return k;
}
map<pair<ll,ll>,ll>mp;
ll call (ll k,ll l,ll r)
{
if(k==1)return 1;
if(mp.find({l,r})!=mp.end())return mp[{l,r}];
cout<<k<<endl;
for(int i=l;i<=r;i++)if(arr[i]==0)cout<<i<<' ';
cout<<endl;
fflush(stdout);
ll x;
cin>>x;
mp[{l,r}]=x;
return x;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
ll n;
cin>>n;
ll l=1,r=2;
while(r<=n)
{
ll k=cnt(l,r);
ll ans=call(k,l,r);
if(ans!=k)
{
ll le=l+1,ri=r;
if(le==ri)
{
v[le-1].push_back(r);
arr[le-1]=1;
}
else
{
while(le<ri)
{
ll k=cnt(le,ri);
//cout<<'*'<<' '<<l<<' '<<r<<' '<<le<<' '<<ri<<endl;
ll ans=call(k,le,ri);
if(ans==k)
{
v[le-1].push_back(r);
arr[le-1]=1;
break;
}
else le++;
}
}
}
r++;
while(arr[l]==1&&l<r-1)l++;
}
for(int i=1;i<=n;i++)
{
if(vis[i]==0)
{
c++;
dfs(i);
}
}
for(int i=1;i<=n;i++)cout<<vis[i]<<' ';
fflush(stdout);
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
28 ms |
572 KB |
Same person came twice to the party. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
130 ms |
836 KB |
Same person came twice to the party. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
208 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
144 ms |
892 KB |
Same person came twice to the party. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
170 ms |
948 KB |
Same person came twice to the party. |
2 |
Halted |
0 ms |
0 KB |
- |