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 <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
//#define endl "\n"
int mod=1e9+7;
const int N=2e5+5;
template<class x>
using ordered_multiset = tree<x, null_type,less_equal<x>, rb_tree_tag,tree_order_statistics_node_update>;
int n,c;
vector<vector<int> > v(155);
bool vis[155];
map<int,int> col;
void dfs(int i) {
vis[i]=true;
col[i]=c;
for (int j:v[i]) {
if (!vis[j]) dfs(j);
}
}
signed main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//freopen(".in", "r", stdin); freopen(".out", "w", stdout);
cin>>n;
for (int i=1;i<=n;i++) {
for (int j=i+1;j<=n;j++) {
cout<<2<<' '<<i<<' '<<j<<endl;
fflush(stdout);
int df; cin>>df;
if (df==1) {
v[i].push_back(j);
v[j].push_back(i);
}
}
}
for (int i=1;i<=n;i++) {
if (!vis[i]) {
c++;
dfs(i);
}
}
cout<<0<<' ';
for(int i=1;i<=n;i++) {
cout<<col[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... |