Submission #1105244

# Submission time Handle Problem Language Result Execution time Memory
1105244 2024-10-25T20:35:17 Z APerson Carnival (CEOI14_carnival) Java 11
Compilation error
0 ms 0 KB
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;
                }
            }
        }
        StringBuilder s = new StringBuilder();
        for(int i : confirmed) {
            s.append(" ").append(i);
        }
        System.out.println(s);
        System.out.flush();
        sc.close();
    }
}

Compilation message

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