結果
問題 | No.1142 XOR と XOR |
ユーザー | tenten |
提出日時 | 2022-08-31 11:01:05 |
言語 | Java21 (openjdk 21) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 2,332 bytes |
コンパイル時間 | 2,409 ms |
コンパイル使用メモリ | 77,636 KB |
実行使用メモリ | 59,764 KB |
最終ジャッジ日時 | 2024-11-08 04:01:21 |
合計ジャッジ時間 | 38,289 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 57 ms
37,188 KB |
testcase_01 | AC | 56 ms
37,128 KB |
testcase_02 | AC | 58 ms
36,700 KB |
testcase_03 | TLE | - |
testcase_04 | AC | 1,806 ms
57,652 KB |
testcase_05 | AC | 1,499 ms
47,576 KB |
testcase_06 | AC | 1,819 ms
47,692 KB |
testcase_07 | TLE | - |
testcase_08 | TLE | - |
testcase_09 | TLE | - |
testcase_10 | TLE | - |
testcase_11 | AC | 54 ms
37,408 KB |
testcase_12 | AC | 53 ms
36,956 KB |
testcase_13 | AC | 54 ms
37,204 KB |
testcase_14 | AC | 1,254 ms
47,160 KB |
testcase_15 | AC | 1,249 ms
47,024 KB |
testcase_16 | AC | 255 ms
40,972 KB |
testcase_17 | AC | 1,679 ms
47,172 KB |
testcase_18 | AC | 578 ms
45,896 KB |
testcase_19 | AC | 1,802 ms
48,000 KB |
testcase_20 | AC | 1,297 ms
46,848 KB |
testcase_21 | AC | 864 ms
46,856 KB |
testcase_22 | AC | 634 ms
46,080 KB |
testcase_23 | AC | 1,748 ms
48,392 KB |
testcase_24 | AC | 1,920 ms
47,836 KB |
testcase_25 | AC | 1,194 ms
47,140 KB |
testcase_26 | AC | 1,779 ms
47,472 KB |
testcase_27 | AC | 1,487 ms
48,028 KB |
ソースコード
import java.io.*; import java.util.*; public class Main { static final int MOD = 1000000007; public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); int m = sc.nextInt(); int k = sc.nextInt(); long[] current = new long[1024]; long[] next = new long[1024]; long[] sumA = new long[1024]; for (int i = 0; i < n; i++) { int x = sc.nextInt(); next[x]++; sumA[x]++; for (int j = 0; j < 1024; j++) { next[x ^ j] += current[j]; next[x ^ j] %= MOD; sumA[x ^ j] += current[j]; sumA[x ^ j] %= MOD; } long[] tmp = current; current = next; next = tmp; Arrays.fill(next, 0); } long[] sumB = new long[1024]; Arrays.fill(current, 0); for (int i = 0; i < m; i++) { int x = sc.nextInt(); next[x]++; sumB[x]++; for (int j = 0; j < 1024; j++) { next[x ^ j] += current[j]; next[x ^ j] %= MOD; sumB[x ^ j] += current[j]; sumB[x ^ j] %= MOD; } long[] tmp = current; current = next; next = tmp; Arrays.fill(next, 0); } long ans = 0; for (int i = 0; i < 1024; i++) { ans += sumA[i] * sumB[i ^ k] % MOD; ans %= MOD; } System.out.println(ans); } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); StringBuilder sb = new StringBuilder(); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public double nextDouble() throws Exception { return Double.parseDouble(next()); } public String next() throws Exception { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }