Submission #307629

#TimeUsernameProblemLanguageResultExecution timeMemory
307629CelloboyCarnival (CEOI14_carnival)Java
100 / 100
416 ms20244 KiB
import java.io.*; import java.util.*; public class carnival { static Reader sc=new Reader(); static PrintWriter out=new PrintWriter((System.out)); public static void main(String args[])throws IOException { int n=sc.nextInt(); ArrayList<Integer> locFirstVisit = new ArrayList<Integer>(); int totalNew[] = new int[n+1]; int arr[] = new int[n+1]; int currCostNum = 0; for(int i = 1; i <= n; i++) { System.out.print(i+" "); for(int j = 1; j <= i; j++) { System.out.print(j + " "); } System.out.flush(); int k = sc.nextInt(); totalNew[i] = k; if(k > totalNew[i-1]) { currCostNum++; arr[i] = currCostNum; locFirstVisit.add(i); }else { for(int j = 0; j < locFirstVisit.size(); j++) { System.out.println("2 " + locFirstVisit.get(j) + " " + i); int t = sc.nextInt(); if(t == 1) { arr[i] = j+1; break; } } } } System.out.print(0 + " "); for(int i = 1; i <= n; i++) { System.out.print(arr[i] + " "); } System.out.println(); } static class Reader { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st=new StringTokenizer(""); public String next() { while(!st.hasMoreTokens()) { try { st=new StringTokenizer(br.readLine()); } catch(Exception e) { e.printStackTrace(); } } return st.nextToken(); } public int nextInt() { return Integer.parseInt(next()); } public long nextLong() { return Long.parseLong(next()); } public double nextDouble() { return Double.parseDouble(next()); } public String nextLine() { try { return br.readLine(); } catch(Exception e) { e.printStackTrace(); } return null; } public boolean hasNext() { String next=null; try { next=br.readLine(); } catch(Exception e) { } if(next==null) { return false; } st=new StringTokenizer(next); return true; } } }
#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...