Submission #1106314

#TimeUsernameProblemLanguageResultExecution timeMemory
1106314APersonCarnival (CEOI14_carnival)Java
0 / 100
174 ms16316 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> same = new ArrayList<>(); 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(); confirmed[i] = sc.nextInt(); if(confirmed[i] == confirmed[i - 1]) { same.add(i); } } for(int check : same) { int min = 0; int max = check - 1; while(min != max) { int mid = (min + max)/2; StringBuilder s = new StringBuilder(); s.append((mid - min) + 1); for(int j = min; j <= mid; j++) s.append(" ").append(j + 1); System.out.println(s); System.out.flush(); int notIncluded = sc.nextInt(); s.append(" ").append(check + 1); System.out.println(s); System.out.flush(); int included = sc.nextInt(); if(included == notIncluded) { max = mid; } else { min = mid + 1; } } confirmed[check] = confirmed[min]; } StringBuilder s = new StringBuilder(); s.append(0); for(int i : confirmed) { s.append(" ").append(i); } System.out.println(s); 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...