結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー spaciaspacia
提出日時 2016-01-17 18:50:53
言語 Java21
(openjdk 21)
結果
AC  
実行時間 515 ms / 5,000 ms
コード長 848 bytes
コンパイル時間 2,441 ms
コンパイル使用メモリ 74,320 KB
実行使用メモリ 53,304 KB
最終ジャッジ日時 2023-09-11 23:06:00
合計ジャッジ時間 7,196 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
50,024 KB
testcase_01 AC 51 ms
50,188 KB
testcase_02 AC 71 ms
51,148 KB
testcase_03 AC 74 ms
51,484 KB
testcase_04 AC 50 ms
49,920 KB
testcase_05 AC 72 ms
51,600 KB
testcase_06 AC 54 ms
50,012 KB
testcase_07 AC 380 ms
52,560 KB
testcase_08 AC 301 ms
52,736 KB
testcase_09 AC 240 ms
52,792 KB
testcase_10 AC 274 ms
52,764 KB
testcase_11 AC 327 ms
52,756 KB
testcase_12 AC 72 ms
51,484 KB
testcase_13 AC 45 ms
49,192 KB
testcase_14 AC 243 ms
52,624 KB
testcase_15 AC 515 ms
52,260 KB
testcase_16 AC 72 ms
51,540 KB
testcase_17 AC 162 ms
52,572 KB
testcase_18 AC 464 ms
52,676 KB
testcase_19 AC 140 ms
53,304 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

class Main {
	
	public static void out (Object o) {
		System.out.println(o);
	}
	
	public static void main (String[] args) throws IOException {
		BufferedReader br = 
			new BufferedReader(new InputStreamReader(System.in));
		
		int max = 1 << 15;
		boolean[] dp = new boolean[max];
		boolean[] check = new boolean[max];
		
		int n = Integer.parseInt(br.readLine());
		String[] line = br.readLine().split(" ");
		int[] nums = new int[n];
		for (int i = 0; i < n; i++) nums[i] = Integer.parseInt(line[i]);
		
		for (int i = 0; i < n; i++) {
			dp[nums[i]] = true;
			for (int j = 0; j < max; j++) {
				if (!dp[j]) continue;
				dp[j^nums[i]] = true;
				check[j^nums[i]] = true;
			}
			Arrays.fill(check , false);
		}
		
		int ans = 0;
		for (int i = 0; i < max; i++)
			if (dp[i]) ans++;
		
		out(ans);
	}
}
0