This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <set>
#include <vector>
using namespace std;
int main()
{
int n;
cin>>n;
int c=1;
int val[n+3];
set<int> left;
for(int i=1;i<=n;i++)
{
val[i]=-1;
left.insert(i);
}
for(int i=1;i<=n;i++)
{
if(val[i]!=-1)
continue;
val[i]=c;
left.erase(i);
vector<int> rem;
for(auto j:left)
{
cout<<2<<' '<<i<<' '<<j<<endl;
int dif;
cin>>dif;
if(dif==1)
{
val[j]=val[i];
rem.push_back(j);
}
}
for(auto j:rem)
{
left.erase(j);
}
c++;
}
cout<<0;
for(int i=1;i<=n;i++)
{
cout<<' '<<val[i];
}
cout<<endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |