Submission #1105240

# Submission time Handle Problem Language Result Execution time Memory
1105240 2024-10-25T20:27:04 Z APerson Carnival (CEOI14_carnival) Java 11
0 / 100
107 ms 15384 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++) {
            System.out.print(i + 1);
            for(int j = 0; j <= i; j++) System.out.print(" " + (j + 1));
            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 time Memory Grader output
1 Execution timed out 103 ms 15352 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 102 ms 15384 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 105 ms 14864 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 107 ms 15204 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 107 ms 14920 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -