結果
問題 | No.1142 XOR と XOR |
ユーザー | face4 |
提出日時 | 2020-08-10 12:04:30 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 441 ms / 2,000 ms |
コード長 | 1,679 bytes |
コンパイル時間 | 4,243 ms |
コンパイル使用メモリ | 76,972 KB |
実行使用メモリ | 83,652 KB |
最終ジャッジ日時 | 2024-04-25 16:42:48 |
合計ジャッジ時間 | 12,467 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 99 ms
52,172 KB |
testcase_01 | AC | 98 ms
52,092 KB |
testcase_02 | AC | 96 ms
51,848 KB |
testcase_03 | AC | 441 ms
83,652 KB |
testcase_04 | AC | 397 ms
76,564 KB |
testcase_05 | AC | 330 ms
65,024 KB |
testcase_06 | AC | 371 ms
74,724 KB |
testcase_07 | AC | 375 ms
80,552 KB |
testcase_08 | AC | 434 ms
81,672 KB |
testcase_09 | AC | 438 ms
81,760 KB |
testcase_10 | AC | 423 ms
82,120 KB |
testcase_11 | AC | 96 ms
52,128 KB |
testcase_12 | AC | 98 ms
52,068 KB |
testcase_13 | AC | 99 ms
51,724 KB |
testcase_14 | AC | 313 ms
65,792 KB |
testcase_15 | AC | 273 ms
62,856 KB |
testcase_16 | AC | 149 ms
52,500 KB |
testcase_17 | AC | 324 ms
66,440 KB |
testcase_18 | AC | 189 ms
58,280 KB |
testcase_19 | AC | 368 ms
67,488 KB |
testcase_20 | AC | 300 ms
65,164 KB |
testcase_21 | AC | 215 ms
60,240 KB |
testcase_22 | AC | 193 ms
57,164 KB |
testcase_23 | AC | 378 ms
68,068 KB |
testcase_24 | AC | 393 ms
76,448 KB |
testcase_25 | AC | 307 ms
65,896 KB |
testcase_26 | AC | 388 ms
67,060 KB |
testcase_27 | AC | 337 ms
65,512 KB |
ソースコード
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++){ ax[0] += (int)((long)acca[i]*(acca[i]-1)/2%mod); ax[0] %= mod; bx[0] += (int)((long)accb[i]*(accb[i]-1)/2%mod); bx[0] %= mod; 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); } }