結果

問題 No.184 たのしい排他的論理和(HARD)
ユーザー uafr_csuafr_cs
提出日時 2015-05-11 20:53:15
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,411 bytes
コンパイル時間 3,532 ms
コンパイル使用メモリ 71,816 KB
実行使用メモリ 71,096 KB
最終ジャッジ日時 2023-09-17 16:50:27
合計ジャッジ時間 11,723 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
55,476 KB
testcase_01 AC 127 ms
55,776 KB
testcase_02 AC 137 ms
55,736 KB
testcase_03 AC 131 ms
54,316 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 127 ms
55,732 KB
testcase_07 WA -
testcase_08 TLE -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.LinkedList;
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		final int N = sc.nextInt();
		long[] inputs = new long[N];
		for(int i = 0; i < N; i++){
			inputs[i] = -sc.nextLong();
		}
		
		Arrays.sort(inputs);
		
		for(int i = 0; i < N; i++){
			inputs[i] = -inputs[i];
		}
		
		/*
		for(int i = 0; i < N; i++){
			String str = Long.toBinaryString(inputs[i]);
			
			for(int j = 0; j < 64 - str.length(); j++){
				System.out.print("0");
			}
			System.out.println(str);
		}
		System.out.println("--------------------------------------------");
		*/
		
		int rank = N;
		for(int cur_index = 0; cur_index < N; cur_index++){
			final int cur_keta = Long.numberOfTrailingZeros(Long.highestOneBit(inputs[cur_index]));
			
			if(inputs[cur_index] == 0){
				rank--;
			}
			
			for(int next_index = cur_index + 1; next_index < N; next_index++){
				final int next_keta = Long.numberOfTrailingZeros(Long.highestOneBit(inputs[next_index]));
				
				if(cur_keta == next_keta){
					inputs[next_index] ^= inputs[cur_index];
				}
			}
		}
		
		/*
		for(int i = 0; i < N; i++){
			String str = Long.toBinaryString(inputs[i]);
			
			for(int j = 0; j < 64 - str.length(); j++){
				System.out.print("0");
			}
			System.out.println(str);
		}
		*/
		
		System.out.println(1l << rank);
		
	}
	
}
0