Submission #1130592

#TimeUsernameProblemLanguageResultExecution timeMemory
1130592QuantumPiCarnival (CEOI14_carnival)Java
Compilation error
0 ms0 KiB
import java.io.*; import java.util.*; public class Carnival2 { public static String[][] queries; public static void main(String[] args) throws IOException { BufferedReader fin = new BufferedReader(new InputStreamReader(System.in)); //BufferedReader fin = new BufferedReader(new FileReader("test.in")); PrintWriter fout = new PrintWriter(System.out); int n = Integer.parseInt(fin.readLine()); queries = new String[n][n]; for (int i=0; i<n; i++) { StringJoiner joiner = new StringJoiner(" "); for (int j=i; j<n; j++) { joiner.add(j+1+""); queries[i][j] = joiner.toString(); } } int[] nums = new int[n]; int currentNum = 1; nums[0] = currentNum++; for (int i=1; i<n; i++) { System.out.println(i+" "+queries[0][i-1]); int a = Integer.parseInt(fin.readLine()); System.out.println(i+1+" "+queries[0][i]); int b = Integer.parseInt(fin.readLine()); if (a < b) { nums[i] = currentNum++; } else { int low = 0; int high = i-1; while (low < high) { int mid = (low+high+1)/2; System.out.println(i-mid+" "+queries[mid][i-1]); int na = Integer.parseInt(fin.readLine()); System.out.println(i+1-mid+" "+queries[mid][i]); int nb = Integer.parseInt(fin.readLine()); if (na == nb) { low = mid; } else { high = mid-1; } } nums[i] = nums[low]; } } StringJoiner joiner = new StringJoiner(" "); joiner.add(0+""); for (int i=0; i<n; i++) { joiner.add(nums[i]+""); } System.out.println(joiner); fin.close(); fout.close(); } }

Compilation message (stderr)

carnival.java:4: error: class Carnival2 is public, should be declared in a file named Carnival2.java
public class Carnival2 {
       ^
1 error

=======