結果

問題 No.184 たのしい排他的論理和(HARD)
コンテスト
ユーザー hama_du
提出日時 2015-05-12 08:08:44
言語 Java
(openjdk 25.0.2)
コンパイル:
javac -encoding UTF8 _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true _class_
結果
AC  
実行時間 523 ms / 5,000 ms
+ 679µs
コード長 824 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,228 ms
コンパイル使用メモリ 84,112 KB
実行使用メモリ 55,620 KB
最終ジャッジ日時 2026-08-06 09:44:43
合計ジャッジ時間 14,602 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

package yukicoder;

import java.util.Scanner;

/**
 * Created by dhamada on 15/05/12.
 */
public class P184 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        int n = in.nextInt();
        long[] a = new long[n];
        for (int i = 0 ; i < n ; i++) {
            a[i] = in.nextLong();
        }

        int ok = 0;
        for (int i = 0 ; i < n ; i++) {
            if (a[i] == 0) {
                continue;
            }
            ok++;
            int found = 0;
            while ((a[i] & (1L<<found)) == 0) {
                found++;
            }
            for (int j = i+1 ; j < n ; j++) {
                if ((a[j] & (1L<<found)) != 0) {
                    a[j] ^= a[i];
                }
            }
        }
        System.out.println(1L<<ok);
    }
}
0