結果

問題 No.1142 XOR と XOR
ユーザー face4face4
提出日時 2020-08-10 11:50:26
言語 Java21
(openjdk 21)
結果
AC  
実行時間 1,921 ms / 2,000 ms
コード長 1,483 bytes
コンパイル時間 2,312 ms
コンパイル使用メモリ 77,260 KB
実行使用メモリ 83,132 KB
最終ジャッジ日時 2024-04-25 16:42:10
合計ジャッジ時間 32,684 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
50,328 KB
testcase_01 AC 56 ms
50,308 KB
testcase_02 AC 55 ms
52,028 KB
testcase_03 AC 1,921 ms
83,132 KB
testcase_04 AC 1,515 ms
76,640 KB
testcase_05 AC 1,274 ms
65,144 KB
testcase_06 AC 1,545 ms
74,776 KB
testcase_07 AC 1,779 ms
80,576 KB
testcase_08 AC 1,901 ms
81,704 KB
testcase_09 AC 1,900 ms
81,864 KB
testcase_10 AC 1,890 ms
81,792 KB
testcase_11 AC 54 ms
49,948 KB
testcase_12 AC 53 ms
50,492 KB
testcase_13 AC 52 ms
50,068 KB
testcase_14 AC 1,059 ms
65,676 KB
testcase_15 AC 1,013 ms
62,848 KB
testcase_16 AC 206 ms
52,796 KB
testcase_17 AC 1,433 ms
66,988 KB
testcase_18 AC 404 ms
57,524 KB
testcase_19 AC 1,561 ms
67,696 KB
testcase_20 AC 1,107 ms
66,368 KB
testcase_21 AC 696 ms
60,672 KB
testcase_22 AC 460 ms
57,568 KB
testcase_23 AC 1,536 ms
68,352 KB
testcase_24 AC 1,663 ms
77,260 KB
testcase_25 AC 996 ms
65,920 KB
testcase_26 AC 1,555 ms
67,032 KB
testcase_27 AC 1,273 ms
66,448 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;
        }
        System.out.println(ans);
    }
}
0