Submission #2556547


Source Code Expand

import static java.util.function.Function.*;
import static java.util.stream.Collectors.*;

import java.util.*;

public class Main {
    public void main(Scanner sc) {
        int n = sc.nextInt();
        Integer a[] = new Integer[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }

        long cnt = 0;
        for (long count : Arrays.stream(a).collect(groupingBy(identity(), counting())).values()) {
            cnt += (count - 1);
        }
        cnt += (cnt % 2);

        System.out.println(n - cnt);
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        new Main().main(sc);
        sc.close();
    }
}

Submission Info

Submission Time
Task D - Card Eater
User minorin
Language Java8 (OpenJDK 1.8.0)
Score 400
Code Size 726 Byte
Status AC
Exec Time 643 ms
Memory 68872 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 2
AC × 17
Set Name Test Cases
Sample 00_example_01.txt, 00_example_02.txt
All 00_example_01.txt, 00_example_02.txt, 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt
Case Name Status Exec Time Memory
00_example_01.txt AC 241 ms 27604 KB
00_example_02.txt AC 197 ms 24520 KB
01.txt AC 199 ms 25036 KB
02.txt AC 322 ms 29792 KB
03.txt AC 209 ms 26836 KB
04.txt AC 218 ms 25044 KB
05.txt AC 199 ms 26832 KB
06.txt AC 615 ms 63084 KB
07.txt AC 613 ms 60784 KB
08.txt AC 623 ms 59260 KB
09.txt AC 626 ms 62184 KB
10.txt AC 604 ms 62324 KB
11.txt AC 620 ms 62108 KB
12.txt AC 582 ms 60072 KB
13.txt AC 584 ms 59716 KB
14.txt AC 643 ms 68872 KB
15.txt AC 582 ms 64672 KB