結果

問題 No.184 たのしい排他的論理和(HARD)
ユーザー GrenacheGrenache
提出日時 2016-07-10 23:15:06
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,899 bytes
コンパイル時間 5,572 ms
コンパイル使用メモリ 75,088 KB
実行使用メモリ 66,752 KB
最終ジャッジ日時 2023-09-17 17:31:50
合計ジャッジ時間 14,042 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
49,440 KB
testcase_01 AC 46 ms
49,432 KB
testcase_02 AC 47 ms
49,424 KB
testcase_03 WA -
testcase_04 AC 47 ms
49,484 KB
testcase_05 AC 46 ms
49,332 KB
testcase_06 AC 46 ms
49,868 KB
testcase_07 AC 46 ms
49,272 KB
testcase_08 AC 267 ms
62,184 KB
testcase_09 AC 158 ms
55,384 KB
testcase_10 AC 245 ms
60,108 KB
testcase_11 AC 208 ms
55,840 KB
testcase_12 AC 277 ms
62,536 KB
testcase_13 AC 287 ms
62,776 KB
testcase_14 AC 239 ms
60,200 KB
testcase_15 AC 291 ms
66,508 KB
testcase_16 AC 271 ms
62,464 KB
testcase_17 AC 273 ms
62,948 KB
testcase_18 AC 46 ms
49,500 KB
testcase_19 AC 44 ms
49,336 KB
testcase_20 AC 199 ms
60,868 KB
testcase_21 AC 302 ms
66,200 KB
testcase_22 AC 302 ms
66,752 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 47 ms
49,260 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 263 ms
61,988 KB
testcase_29 AC 280 ms
63,516 KB
testcase_30 AC 263 ms
62,364 KB
testcase_31 AC 261 ms
62,532 KB
testcase_32 AC 283 ms
62,416 KB
testcase_33 AC 294 ms
66,740 KB
testcase_34 AC 308 ms
66,488 KB
testcase_35 AC 306 ms
66,688 KB
testcase_36 AC 295 ms
66,620 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;


public class Main_yukicoder184 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Printer pr = new Printer(System.out);

        int n = sc.nextInt();

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

        int ret = 0;
        for (int i = 0; i <= 60; i++) {
        	long mask = 0x1L << i;

        	boolean flag = false;
        	for (int j = i; j < n; j++) {
        		if (!flag && (a[j] & mask) != 0) {
        			flag = true;
        			long tmp = a[j];
        			a[j] = a[i];
        			a[i] = tmp;
        			ret++;
        		} else if (flag && (a[j] & mask) != 0) {
        			a[j] ^= a[i];
        		}
        	}
        }

        pr.println(0x1L << ret);

        pr.close();
        sc.close();
    }

	@SuppressWarnings("unused")
	private static class Scanner {
		BufferedReader br;
		Iterator<String> it;

		Scanner (InputStream in) {
			br = new BufferedReader(new InputStreamReader(in));
		}

		String next() throws RuntimeException  {
			try {
				if (it == null || !it.hasNext()) {
					it = Arrays.asList(br.readLine().split(" ")).iterator();
				}
				return it.next();
			} catch (IOException e) {
				throw new IllegalStateException();
			}
		}

		int nextInt() throws RuntimeException {
			return Integer.parseInt(next());
		}

		long nextLong() throws RuntimeException {
			return Long.parseLong(next());
		}

		float nextFloat() throws RuntimeException {
			return Float.parseFloat(next());
		}

		double nextDouble() throws RuntimeException {
			return Double.parseDouble(next());
		}

		void close() {
			try {
				br.close();
			} catch (IOException e) {
//				throw new IllegalStateException();
			}
		}
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}
0