제출 #403258

#제출 시각아이디문제언어결과실행 시간메모리
403258rainliofficial사육제 (CEOI14_carnival)Java
0 / 100
1288 ms18064 KiB
import java.io.*; import java.util.*; public class carnival { static int n; public static void main(String[] args) throws IOException{ BufferedReader file = new BufferedReader(new InputStreamReader(System.in)); n = Integer.parseInt(file.readLine()); int[] ans = new int[n]; int g = 1; for (int i=0; i<n; i++){ if (ans[i] == 0){ ans[i] = g++; } for (int j=i+1; j<n; j++){ if (ans[j] == 0 && get(i+1, j+1) == 1){ ans[j] = ans[i]; } } } System.out.print("0"); for (int i : ans){ System.out.print(" " + i); } } public static int get(int n1, int n2) throws IOException{ System.out.print("2 " + n1 + " " + n2); System.out.println(); System.out.flush(); BufferedReader file = new BufferedReader(new InputStreamReader(System.in)); return Integer.parseInt(file.readLine()); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...