This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
import java.util.*;
public class carnival {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] confirmed = new int[n];
int curNum = 1;
for(int i = 0; i < n; i++) {
if(confirmed[i] != 0) continue;
confirmed[i] = curNum;
for(int j = i + 1; j < n; j++) {
if(confirmed[j] != 0) continue;
System.out.println(2 + " " + (i + 1) + " " + (j + 1)); System.out.flush();
int num = sc.nextInt();
if(num == 1) confirmed[j] = curNum;
}
curNum++;
}
System.out.print(0);
for(int i : confirmed) {
System.out.print(" " + i);
}
System.out.flush();
sc.close();
}
}
# | 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... |