結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー TLwiegehttTLwiegehtt
提出日時 2015-07-15 11:23:25
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 217 ms / 5,000 ms
コード長 438 bytes
コンパイル時間 1,312 ms
コンパイル使用メモリ 24,388 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-11 11:44:45
合計ジャッジ時間 4,086 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 217 ms
4,376 KB
testcase_08 AC 194 ms
4,380 KB
testcase_09 AC 133 ms
4,380 KB
testcase_10 AC 159 ms
4,380 KB
testcase_11 AC 210 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 180 ms
4,376 KB
testcase_15 AC 215 ms
4,380 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 48 ms
4,380 KB
testcase_18 AC 202 ms
4,376 KB
testcase_19 AC 24 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>


char dp[3][32780];

int main(void){
	int i,j,n;
	int cnt=0;
	scanf("%d", &n);
	
	dp[0][0] = 1;
	for(i=1;i<=n;i++){
		int a;
		scanf("%d", &a);
		for(j=0;j<32780;j++){
			int front = (i+1)%2;
			int now = i%2;
			
			if(dp[front][j] == 1){
				int xor = a^j;
				dp[now][xor] = 1;
				dp[now][j] = 1;
			}
			
		}
	}
	
	for(i=0;i<32780;i++){
		if(dp[n%2][i] == 1){
			cnt++;
		}
	}
	
	printf("%d\n", cnt);
	return 0;
}
0