結果

問題 No.1142 XOR と XOR
ユーザー face4face4
提出日時 2020-08-10 11:57:43
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,505 bytes
コンパイル時間 2,467 ms
コンパイル使用メモリ 76,144 KB
実行使用メモリ 82,228 KB
最終ジャッジ日時 2024-04-16 07:39:17
合計ジャッジ時間 11,237 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
51,908 KB
testcase_01 WA -
testcase_02 AC 96 ms
51,876 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 96 ms
51,612 KB
testcase_12 AC 96 ms
51,968 KB
testcase_13 AC 96 ms
51,992 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
権限があれば一括ダウンロードができます

ソースコード

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];
            acca[tmp]++;
        }
        tmp = 0;
        for(int i = 0; i < m; i++){
            tmp ^= b[i];
            accb[tmp]++;
        }
        for(int i = 0; i < 1<<10; i++){
            for(int j = i+1; j < 1<<10; j++){
                ax[i^j] += (long)acca[i]*acca[j]%mod;
                ax[i^j] %= mod;
                bx[i^j] += (long)accb[i]*accb[j]%mod;
                bx[i^j] %= mod;
            }
        }
        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