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>
#define int long long
#define mod 1000000007
using namespace std;
vector<int>adj[200001];
int vs[151]; int c;
void dfs(int x){
vs[x] = c;
for(auto s:adj[x]){
if(!vs[s]){
vs[s] = c;
dfs(s);
}
}
}
signed main(){
int n; cin >> n;
for(int i = 0; i < n; i++){
for(int j = i + 1; j < n; j++){
cout << 2 << ' ' << i +1 << ' ' << j + 1 << endl;
int a; cin >> a;
if(a == 1){
adj[i].push_back(j);
}
}
}
for(int i = 0; i < n; i++){
if(!vs[i]){
c++;
dfs(i);
}
}
cout << 0 << ' ' ;
for(int i = 0; i < n;i++){
cout << vs[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... |