Submission #1105245

# Submission time Handle Problem Language Result Execution time Memory
1105245 2024-10-25T20:35:39 Z APerson Carnival (CEOI14_carnival) Java 11
0 / 100
214 ms 17252 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();
    }
}
# Verdict Execution time Memory Grader output
1 Execution timed out 191 ms 16312 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 208 ms 17252 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 168 ms 16280 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 214 ms 17220 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 199 ms 17148 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -