結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー htensaihtensai
提出日時 2019-12-19 15:00:11
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 727 bytes
コンパイル時間 4,756 ms
コンパイル使用メモリ 72,636 KB
実行使用メモリ 71,620 KB
最終ジャッジ日時 2023-09-21 07:03:31
合計ジャッジ時間 9,708 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
49,840 KB
testcase_01 AC 44 ms
49,428 KB
testcase_02 AC 76 ms
50,704 KB
testcase_03 AC 52 ms
50,520 KB
testcase_04 AC 44 ms
49,308 KB
testcase_05 AC 73 ms
51,764 KB
testcase_06 AC 45 ms
49,124 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Main {
    static HashSet<Integer>[] graph;
    static int n;
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        String[] line = br.readLine().split(" ", n);
        HashSet<Integer> set = new HashSet<>();
        set.add(0);
        for (int i = 0; i < n; i++) {
            int a = Integer.parseInt(line[i]);
            HashSet<Integer> tmp = new HashSet<>();
            for (int x : set) {
                tmp.add(x ^ a);
            }
            set.addAll(tmp);
        }
        System.out.print(set.size());
    }
}
0