Submission #1105243

#TimeUsernameProblemLanguageResultExecution timeMemory
1105243APersonCarnival (CEOI14_carnival)Java
0 / 100
210 ms17220 KiB
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]; ArrayList<Integer> change = new ArrayList<>(); change.add(1); confirmed[0] = 1; int curNum = 1; for(int i = 1; i < n; i++) { StringBuilder s = new StringBuilder(); s.append(i + 1); for(int j = 0; j <= i; j++) s.append(" ").append(j + 1); System.out.println(s); System.out.flush(); int next = sc.nextInt(); if(next > curNum) { confirmed[i] = next; curNum = next; change.add(i + 1); } } for(int i = 1; i < n; i++) { if(confirmed[i] != 0) continue; for(int j = 0; j < change.size(); j++) { System.out.print(2 + " " + (i + 1) + " " + change.get(j)); System.out.flush(); if(sc.nextInt() == 1) { confirmed[i] = j + 1; break; } } } System.out.print(0); for(int i : confirmed) { System.out.print(" " + i); } System.out.flush(); sc.close(); } }
#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...