結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー akakimidoriakakimidori
提出日時 2015-07-26 19:25:10
言語 C90
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 625 bytes
コンパイル時間 190 ms
コンパイル使用メモリ 24,936 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-22 23:33:25
合計ジャッジ時間 1,364 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
#include<stdlib.h>

#define ABS(x) ((x)>0?(x):-(x))
#define MAX(a,b) ((a)>(b)?(a):(b))

typedef long long int ln;

int main(void){

	int N;
	scanf("%d",&N);

	int *A;
	A=(int *)malloc(sizeof(int)*N);

	int i;
	for(i=0;i<N;i++) scanf("%d\n",&A[i]);

	int UP=1<<15;
	char *can;
	can=(char *)malloc(sizeof(char)*UP);

	for(i=0;i<UP;i++) can[i]=0;

	can[0]=0;
	int max=0;
	for(i=0;i<N;i++){
		int j;
		for(j=0;j<=max;j++){
			if(can[j]){
				int t=j^A[i];
				can[t]=1;
				max=MAX(max,t);
			}
		}
	}

	int count=0;
	for(i=0;i<=max;i++) count+=can[i];
	printf("%d\n",count);
	free(A);
	free(can);
	return 0;
}
0