Submission #1106314

# Submission time Handle Problem Language Result Execution time Memory
1106314 2024-10-30T00:38:20 Z APerson Carnival (CEOI14_carnival) Java 11
0 / 100
174 ms 16316 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> same = new ArrayList<>();
        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();
            confirmed[i] = sc.nextInt();
            if(confirmed[i] == confirmed[i - 1]) {
                same.add(i);
            }
        }
        for(int check : same) {
            int min = 0;
            int max = check - 1;
            while(min != max) {
                int mid = (min + max)/2;
                StringBuilder s = new StringBuilder();
                s.append((mid - min) + 1);
                for(int j = min; j <= mid; j++) s.append(" ").append(j + 1);
                System.out.println(s); System.out.flush();
                int notIncluded = sc.nextInt();
                s.append(" ").append(check + 1);
                System.out.println(s); System.out.flush();
                int included = sc.nextInt();
                if(included == notIncluded) {
                    max = mid;
                } else {
                    min = mid + 1;
                }
            }
            confirmed[check] = confirmed[min];
        }
        StringBuilder s = new StringBuilder();
        s.append(0);
        for(int i : confirmed) {
            s.append(" ").append(i);
        }
        System.out.println(s);
        System.out.flush();
        sc.close();
    }
}
# Verdict Execution time Memory Grader output
1 Runtime error 140 ms 15960 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 166 ms 15976 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 127 ms 15252 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 162 ms 16072 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 174 ms 16316 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -