結果
問題 | No.1142 XOR と XOR |
ユーザー | tenten |
提出日時 | 2022-08-31 11:01:05 |
言語 | Java21 (openjdk 21) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 2,332 bytes |
コンパイル時間 | 2,311 ms |
コンパイル使用メモリ | 78,212 KB |
実行使用メモリ | 61,708 KB |
最終ジャッジ日時 | 2024-04-25 16:52:39 |
合計ジャッジ時間 | 36,580 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 53 ms
50,396 KB |
testcase_01 | AC | 51 ms
50,304 KB |
testcase_02 | AC | 53 ms
50,440 KB |
testcase_03 | TLE | - |
testcase_04 | AC | 1,733 ms
57,692 KB |
testcase_05 | AC | 1,452 ms
57,920 KB |
testcase_06 | AC | 1,746 ms
57,912 KB |
testcase_07 | TLE | - |
testcase_08 | TLE | - |
testcase_09 | TLE | - |
testcase_10 | TLE | - |
testcase_11 | AC | 52 ms
50,428 KB |
testcase_12 | AC | 52 ms
50,608 KB |
testcase_13 | AC | 51 ms
50,316 KB |
testcase_14 | AC | 1,209 ms
57,952 KB |
testcase_15 | AC | 1,189 ms
57,920 KB |
testcase_16 | AC | 243 ms
53,200 KB |
testcase_17 | AC | 1,599 ms
57,804 KB |
testcase_18 | AC | 550 ms
57,584 KB |
testcase_19 | AC | 1,733 ms
57,464 KB |
testcase_20 | AC | 1,261 ms
57,724 KB |
testcase_21 | AC | 823 ms
57,976 KB |
testcase_22 | AC | 623 ms
57,552 KB |
testcase_23 | AC | 1,643 ms
59,668 KB |
testcase_24 | AC | 1,810 ms
57,716 KB |
testcase_25 | AC | 1,134 ms
58,108 KB |
testcase_26 | AC | 1,687 ms
57,912 KB |
testcase_27 | AC | 1,413 ms
59,924 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(); } }