#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(x) (int) (x).size()
#define endl '\n'
bool ask(int i, int j)
{
cout << "2 " << i+1 << " " << j+1 << endl << flush;
int x;
cin >> x;
return x==1;
}
int main()
{
cin.tie(0) -> sync_with_stdio(0);
int n;
cin >> n;
int color[n+5]={}, j1=1;
for(int i = 0;i < n;i++)
{
if(color[i]==0) color[i]=j1;
else continue;
for(int j = i+1;j < n;j++)
{
if(color[j]==0)
{
if(ask(i, j)) color[j]=j1;
}
}
// if(color[i]==0) j1++;
j1++;
}
cout << "0 ";
for(int i =0 ;i < n;i++) cout<<color[i] << " ";
}
| # | 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... |