結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー fjafjafjafjafjafja
提出日時 2017-10-03 21:33:25
言語 Java21
(openjdk 21)
結果
MLE  
実行時間 -
コード長 630 bytes
コンパイル時間 3,698 ms
コンパイル使用メモリ 72,608 KB
実行使用メモリ 730,776 KB
最終ジャッジ日時 2023-08-10 05:35:52
合計ジャッジ時間 11,665 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

import java.util.ArrayList;
import java.util.HashSet;
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);
		for(int i=0;i<n;i++){
			int buf=al.size();
			int a=sc.nextInt();
			for(int j=0;j<buf;j++){
				int newint=al.get(j)^a;
				for(int k=0;k<buf;k++){
					if(newint==al.get(k)){
						break;
					}
					al.add(newint);
				}
			}
		}
		HashSet<Integer> hs=new HashSet<Integer>();
		for(Integer all:al){
			hs.add(all);
		}
		System.out.println(hs.size());
	}
}
0