/*
Code by @marlov
*/
#include <iostream>
#include <fstream>
#include <string>
#include <sstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <utility>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <stack>
#include <queue>
#include <iterator>
#include <bitset>
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
#define maxN 155
int N;
int tc=0;
int tg=0;
int p[maxN];
int r[maxN];
bool decided[maxN];
int findP(int n){
if(n==p[n]) return n;
int pv=findP(p[n]);
p[n]=pv;
return pv;
}
void combine(int a,int b){
int p1=findP(a);
int p2=findP(b);
if(r[p1]<r[p2]) swap(p1,p2);
p[p2]=p1;
r[p1]=max(r[p1],r[p2]+1);
tg--;
}
int main() {
ios_base::sync_with_stdio(0); cin.tie(0);
cin>>N;
tg=0;
for(int i=0;i<N;i++){
p[i]=i;
r[i]=1;
}
cout<<N<<" ";
for(int i=0;i<N;i++){
cout<<i+1<<" ";
}
cout<<endl;
cin>>tc;
for(int i=0;i<N;i++){
if(decided[i]) continue;
for(int j=i+1;j<N;j++){
if(decided[j]) continue;
cout<<"2 "<<i+1<<" "<<j+1<<endl;
int gv;
cin>>gv;
if(gv==1){
decided[j]=true;
combine(i,j);
}
}
decided[i]=true;
}
cout<<"0 ";
for(int i=0;i<N;i++){
cout<<findP(i)+1<<" ";
}
cout<<endl;
return 0;
}
/* stuff you should look for
* int overflow, array bounds
* special cases (n=1,n=0?)
* do smth instead of nothing and stay organized
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
8 ms |
364 KB |
Integer 19 violates the range [1, 11] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
8 ms |
364 KB |
Integer 6 violates the range [1, 5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
364 KB |
Output is correct |
2 |
Incorrect |
8 ms |
364 KB |
Integer 11 violates the range [1, 8] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
364 KB |
Integer 5 violates the range [1, 4] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
492 KB |
Output is correct |
2 |
Incorrect |
16 ms |
364 KB |
Integer 20 violates the range [1, 17] |
3 |
Halted |
0 ms |
0 KB |
- |