結果

問題 No.184 たのしい排他的論理和(HARD)
ユーザー uafr_csuafr_cs
提出日時 2015-05-11 21:51:29
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,860 bytes
コンパイル時間 2,859 ms
コンパイル使用メモリ 75,520 KB
実行使用メモリ 63,540 KB
最終ジャッジ日時 2023-09-17 16:56:36
合計ジャッジ時間 10,446 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
49,420 KB
testcase_01 AC 43 ms
49,368 KB
testcase_02 AC 45 ms
49,832 KB
testcase_03 AC 44 ms
49,296 KB
testcase_04 AC 44 ms
49,440 KB
testcase_05 AC 44 ms
49,740 KB
testcase_06 AC 44 ms
49,428 KB
testcase_07 AC 44 ms
49,396 KB
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 AC 43 ms
49,288 KB
testcase_20 AC 205 ms
56,060 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 45 ms
49,528 KB
testcase_25 WA -
testcase_26 AC 44 ms
49,420 KB
testcase_27 AC 44 ms
49,380 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Main {
	
	public static void main(String[] args) throws IOException{
		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();
		}
		
		final int SIZE = 64;
		long[] pivot = new long[SIZE + 1];
		for(int i = 0; i < N; i++){
			long value = inputs[i];
			
			for(int bit = SIZE; bit >= 0; bit--){
				if((value & (1 << bit)) == 0){
					continue;
				}
				
				if(pivot[bit] == 0){
					pivot[bit] = value;
					break;
				}else{
					value ^= pivot[bit];
				}
			}
		}
		
		int rank = SIZE + 1;
		for(int i = 0; i <= SIZE; i++){
			if(pivot[i] == 0){
				rank--;
			}
		}
		
		System.out.println(1l << rank);
	}
	
	public static class Scanner {
	    private BufferedReader br;
	    private StringTokenizer tok;

	    public Scanner(InputStream is) throws IOException {
	        br = new BufferedReader(new InputStreamReader(is));
	    }

	    private void getLine() throws IOException {
	        while (!hasNext()) { tok = new StringTokenizer(br.readLine()); }
	    }

	    private boolean hasNext() {
	        return tok != null && tok.hasMoreTokens();
	    }

	    public String next() throws IOException {
	        getLine(); return tok.nextToken();
	    }

	    public int nextInt() throws IOException {
	        return Integer.parseInt(next());
	    }
	    
	    public long nextLong() throws IOException {
	    	return Long.parseLong(next());
	    }
	    
	    public void close() throws IOException {
	        br.close();
	    }
	}
	
}
0