結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー fjafjafjafjafjafja
提出日時 2017-10-03 21:56:58
言語 Java21
(openjdk 21)
結果
AC  
実行時間 798 ms / 5,000 ms
コード長 518 bytes
コンパイル時間 5,337 ms
コンパイル使用メモリ 74,796 KB
実行使用メモリ 56,400 KB
最終ジャッジ日時 2023-09-12 15:15:58
合計ジャッジ時間 11,108 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
56,136 KB
testcase_01 AC 124 ms
56,400 KB
testcase_02 AC 127 ms
39,816 KB
testcase_03 AC 125 ms
39,732 KB
testcase_04 AC 120 ms
39,312 KB
testcase_05 AC 131 ms
40,492 KB
testcase_06 AC 122 ms
39,460 KB
testcase_07 AC 798 ms
45,924 KB
testcase_08 AC 567 ms
45,264 KB
testcase_09 AC 479 ms
45,052 KB
testcase_10 AC 505 ms
45,368 KB
testcase_11 AC 568 ms
45,212 KB
testcase_12 AC 130 ms
40,416 KB
testcase_13 AC 119 ms
39,884 KB
testcase_14 AC 207 ms
43,880 KB
testcase_15 AC 617 ms
46,004 KB
testcase_16 AC 119 ms
39,748 KB
testcase_17 AC 284 ms
41,872 KB
testcase_18 AC 662 ms
45,512 KB
testcase_19 AC 234 ms
41,564 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.ArrayList;
import java.util.Scanner;

public class N183 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		ArrayList<Integer> al=new ArrayList<Integer>();
		al.add(0);
		int[] h=new int[16384*2];
		h[0]=1;
		for(int i=0;i<n;i++){
			int a=sc.nextInt();
			int buf=al.size();
			for(int j=0;j<buf;j++){
				int newint=al.get(j)^a;
				if(h[newint]==0){
					al.add(newint);
					h[newint]++;
				}
			}
		}
		System.out.println(al.size());
	}
}
0