結果

問題 No.1142 XOR と XOR
ユーザー face4face4
提出日時 2020-08-10 11:49:02
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,548 bytes
コンパイル時間 2,126 ms
コンパイル使用メモリ 77,188 KB
実行使用メモリ 84,020 KB
最終ジャッジ日時 2024-04-16 07:23:29
合計ジャッジ時間 35,240 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 58 ms
36,972 KB
testcase_03 TLE -
testcase_04 AC 1,639 ms
65,752 KB
testcase_05 AC 1,340 ms
55,220 KB
testcase_06 AC 1,632 ms
64,568 KB
testcase_07 WA -
testcase_08 AC 1,924 ms
81,596 KB
testcase_09 AC 1,987 ms
81,624 KB
testcase_10 AC 1,982 ms
81,768 KB
testcase_11 AC 59 ms
37,084 KB
testcase_12 AC 57 ms
37,084 KB
testcase_13 AC 58 ms
36,924 KB
testcase_14 AC 1,103 ms
55,612 KB
testcase_15 AC 1,072 ms
52,432 KB
testcase_16 AC 224 ms
40,940 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 1,203 ms
55,728 KB
testcase_21 AC 739 ms
50,072 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 1,704 ms
66,332 KB
testcase_25 AC 1,031 ms
56,172 KB
testcase_26 AC 1,609 ms
56,896 KB
testcase_27 AC 1,280 ms
55,192 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;

public class Main {
    static int mod = 1000000007;
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] line = br.readLine().split(" ");
        int n = Integer.parseInt(line[0]);
        int m = Integer.parseInt(line[1]);
        int k = Integer.parseInt(line[2]);
        int a[] = new int[n], b[] = new int[m];
        line = br.readLine().split(" ");
        for(int i = 0; i < n; i++)  a[i] = Integer.parseInt(line[i]);
        line = br.readLine().split(" ");
        for(int i = 0; i < m; i++)  b[i] = Integer.parseInt(line[i]);
        int acca[] = new int[1<<10], ax[] = new int[1<<10], accb[] = new int[1<<10], bx[] = new int[1<<10];
        acca[0] = accb[0] = 1;
        int tmp = 0;
        for(int i = 0; i < n; i++){
            tmp ^= a[i];
            for(int j = 0; j < 1<<10; j++){
                ax[j^tmp] += acca[j];
                ax[j^tmp] %= mod;
            }
            acca[tmp]++;
        }
        tmp = 0;
        for(int i = 0; i < m; i++){
            tmp ^= b[i];
            for(int j = 0; j < 1<<10; j++){
                bx[j^tmp] += accb[j];
                bx[j^tmp] %= mod;
            }
            accb[tmp]++;
        }
        long ans = 0;
        for(int i = 0; i < 1<<10; i++){
            ans += (long)(ax[i]) * bx[k^i] % mod;
            ans %= mod;
        }
        if(k == 0){
            ans = (ans+mod-1)%mod;
        }
        System.out.println(ans);
    }
}
0