fork download
  1. import java.util.Scanner;
  2. public class Main {
  3. public static void main (String[] args) {
  4. Scanner scanner = new Scanner(System.in);
  5. int n = scanner.nextInt();
  6. int m = scanner.nextInt();
  7. int k = scanner.nextInt();
  8. int num;
  9. boolean children[] = new boolean[n];
  10. for (int i = 0; i < n; i++) {
  11. children[i] = false;
  12. }
  13. for (int i = 0; i < m + k; i++) {
  14. num = scanner.nextInt();
  15. num--;
  16. children[num] = true;
  17. }
  18. System.out.println(n - m - k);
  19. for (int i = 0; i < n; i++) {
  20. if (!children[i]) {
  21. System.out.print((i + 1) + " ");
  22. }
  23. }
  24. }
  25. }
Success #stdin #stdout 0.07s 2184192KB
stdin
12 3 3
1 2 3
11 10 8
stdout
6
4 5 6 7 9 12