結果

問題 No.183 たのしい排他的論理和(EASY)
コンテスト
ユーザー kenkoooo
提出日時 2015-04-17 23:59:30
言語 Java
(openjdk 25.0.2)
コンパイル:
javac -encoding UTF8 _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true _class_
結果
AC  
実行時間 1,031 ms / 5,000 ms
コード長 587 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,744 ms
コンパイル使用メモリ 84,020 KB
実行使用メモリ 48,916 KB
最終ジャッジ日時 2026-03-18 10:56:06
合計ジャッジ時間 10,238 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		boolean[] dp = new boolean[1 << 14 + 1];
		for (int i = 0; i < N; i++) {
			dp[sc.nextInt()] = true;
		}
		sc.close();

		for (int i = 0; i < dp.length; i++) {
			if (!dp[i]) {
				continue;
			}
			for (int j = 0; j < dp.length; j++) {
				if (dp[j]) {
					dp[i ^ j] = true;
				}
			}
		}

		int ans = 0;
		for (int i = 0; i < dp.length; i++) {
			if (dp[i]) {
				ans++;
			}
		}
		System.out.println(ans);

	}
}
0