結果

問題 No.183 たのしい排他的論理和(EASY)
コンテスト
ユーザー kenkoooo
提出日時 2015-04-17 23:59:30
言語 Java
(openjdk 27 + ACL)
コンパイル:
javac -J-Duser.language=en -encoding UTF8 -cp /opt/aclib/ac_library.jar _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true -cp .:/opt/aclib/ac_library.jar _class_
結果
AC  
実行時間 1,036 ms / 5,000 ms
+ 294µs
コード長 587 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,585 ms
コンパイル使用メモリ 85,576 KB
実行使用メモリ 49,988 KB
最終ジャッジ日時 2026-10-12 14:30:27
合計ジャッジ時間 11,954 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

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