#include <bits/stdc++.h>
using namespace std;
int n,sz,nrG,nr;
int a[155];
vector<int> v[155];
int query(int id, int x)
{
cout<<(int)v[id].size() + 1<<' ';
for(int it : v[id])
cout<<it<<' ';
cout<<x;
cout<<endl;
int ans;
cin>>ans;
return ans;
}
int query2(int x, int y)
{
cout<<2<<' '<<x<<' '<<y<<'\n';
cout<<endl;
int ans;
cin>>ans;
return ans;
}
int main()
{
cin>>n;
sz=sqrt(n);
nrG=1;
nr=1;
a[1]=1;
v[1].push_back(1);
for(int i=2;i<=n;i++)
{
bool found = false;
for(int j=1;j<=nrG;j++)
{
if(query(j, i) == (int)v[j].size())
{
found = true;
for(int it : v[j])
if(query2(it, i) == 1)
{
a[i] = a[it];
break;
}
break;
}
}
if(!found)
{
nr++;
a[i]=nr;
if((int)v[nrG].size() == sz)
nrG++;
v[nrG].push_back(i);
}
}
cout<<"0 ";
for(int i=1;i<=n;i++)
cout<<a[i]<<' ';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
208 KB |
Output is correct |
2 |
Correct |
8 ms |
208 KB |
Output is correct |
3 |
Correct |
12 ms |
208 KB |
Output is correct |
4 |
Correct |
11 ms |
208 KB |
Output is correct |
5 |
Correct |
5 ms |
208 KB |
Output is correct |
6 |
Correct |
3 ms |
208 KB |
Output is correct |
7 |
Correct |
8 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
208 KB |
Output is correct |
2 |
Correct |
9 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 |
3 ms |
208 KB |
Output is correct |
6 |
Correct |
4 ms |
208 KB |
Output is correct |
7 |
Correct |
10 ms |
292 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
208 KB |
Output is correct |
2 |
Correct |
9 ms |
208 KB |
Output is correct |
3 |
Correct |
11 ms |
208 KB |
Output is correct |
4 |
Correct |
8 ms |
208 KB |
Output is correct |
5 |
Correct |
3 ms |
208 KB |
Output is correct |
6 |
Correct |
3 ms |
208 KB |
Output is correct |
7 |
Correct |
9 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
208 KB |
Output is correct |
2 |
Correct |
6 ms |
208 KB |
Output is correct |
3 |
Correct |
5 ms |
208 KB |
Output is correct |
4 |
Correct |
12 ms |
208 KB |
Output is correct |
5 |
Correct |
5 ms |
208 KB |
Output is correct |
6 |
Correct |
7 ms |
208 KB |
Output is correct |
7 |
Correct |
9 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
208 KB |
Output is correct |
2 |
Correct |
4 ms |
208 KB |
Output is correct |
3 |
Correct |
9 ms |
208 KB |
Output is correct |
4 |
Correct |
10 ms |
208 KB |
Output is correct |
5 |
Correct |
7 ms |
208 KB |
Output is correct |
6 |
Correct |
10 ms |
208 KB |
Output is correct |
7 |
Correct |
10 ms |
208 KB |
Output is correct |