結果

問題 No.182 新規性の虜
ユーザー fkwnw3_1243fkwnw3_1243
提出日時 2017-04-30 10:51:39
言語 Java21
(openjdk 21)
結果
AC  
実行時間 258 ms / 5,000 ms
コード長 983 bytes
コンパイル時間 3,845 ms
コンパイル使用メモリ 73,792 KB
実行使用メモリ 69,752 KB
最終ジャッジ日時 2023-08-27 15:08:49
合計ジャッジ時間 8,717 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
49,460 KB
testcase_01 AC 39 ms
49,336 KB
testcase_02 AC 39 ms
49,200 KB
testcase_03 AC 40 ms
49,284 KB
testcase_04 AC 40 ms
49,228 KB
testcase_05 AC 42 ms
49,344 KB
testcase_06 AC 41 ms
49,268 KB
testcase_07 AC 40 ms
49,228 KB
testcase_08 AC 203 ms
62,388 KB
testcase_09 AC 258 ms
64,220 KB
testcase_10 AC 230 ms
62,904 KB
testcase_11 AC 207 ms
62,312 KB
testcase_12 AC 156 ms
54,332 KB
testcase_13 AC 41 ms
49,244 KB
testcase_14 AC 43 ms
49,304 KB
testcase_15 AC 41 ms
49,584 KB
testcase_16 AC 41 ms
49,428 KB
testcase_17 AC 41 ms
49,176 KB
testcase_18 AC 193 ms
60,200 KB
testcase_19 AC 174 ms
58,116 KB
testcase_20 AC 143 ms
56,016 KB
testcase_21 AC 200 ms
60,852 KB
testcase_22 AC 137 ms
57,148 KB
testcase_23 AC 40 ms
49,124 KB
testcase_24 AC 255 ms
69,752 KB
testcase_25 AC 155 ms
58,520 KB
testcase_26 AC 114 ms
52,544 KB
testcase_27 AC 41 ms
49,240 KB
evil01.txt AC 270 ms
71,000 KB
evil02.txt AC 270 ms
69,544 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

import static java.lang.System.in;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        int N = Integer.parseInt(reader.readLine());
        String[] inputs = reader.readLine().split(" ");
        Set<Long> newElements = new HashSet<>();
        Set<Long> duplicateElements= new HashSet<>();


        for (int i = 0; i < N; i++) {
            long a = Long.parseLong(inputs[i]);
            if(duplicateElements.contains(a)) {

            } else if (newElements.contains(a)) {
                newElements.remove(a);
                duplicateElements.add(a);
            } else {
                newElements.add(a);
            }
        }
        System.out.println(newElements.size());
    }
}
0