Submission #1082177


Source Code Expand

import java.io.*;
import java.util.*;

class Main{
	public static void main(String[] args) throws Exception{
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(reader.readLine());
		HashSet<Integer> set = new HashSet<>(n);
		int result = 0;
		for(String _s : reader.readLine().split(" ")) {
			int _num = Integer.parseInt(_s);
			if(set.contains(_num)) {
				result++;
			}else {
				set.add(_num);
			}
		}
		System.out.println(n-(result+((result%2==1)?1:0)));
	}
}

Submission Info

Submission Time
Task D - Card Eater
User kotobuki
Language Java7 (OpenJDK 1.7.0)
Score 400
Code Size 543 Byte
Status AC
Exec Time 294 ms
Memory 34924 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 106 ms 7892 KB
00_example_02.txt AC 100 ms 7892 KB
01.txt AC 100 ms 7892 KB
02.txt AC 162 ms 11704 KB
03.txt AC 101 ms 8020 KB
04.txt AC 104 ms 8020 KB
05.txt AC 101 ms 7892 KB
06.txt AC 260 ms 25164 KB
07.txt AC 257 ms 25064 KB
08.txt AC 274 ms 26056 KB
09.txt AC 255 ms 24864 KB
10.txt AC 267 ms 24708 KB
11.txt AC 269 ms 25708 KB
12.txt AC 268 ms 24600 KB
13.txt AC 268 ms 25084 KB
14.txt AC 294 ms 34924 KB
15.txt AC 267 ms 25160 KB