結果
| 問題 | No.3205 Range Pairwise Xor Query |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-07-18 21:31:39 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 423 bytes |
| コンパイル時間 | 476 ms |
| コンパイル使用メモリ | 82,516 KB |
| 実行使用メモリ | 146,556 KB |
| 最終ジャッジ日時 | 2025-07-18 21:32:21 |
| 合計ジャッジ時間 | 9,943 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | WA * 20 |
ソースコード
MAX = 5
N, Q = map(int, input().split())
A = list(map(int, input().split()))
acc = [[] for i in range(MAX)]
for i in range(MAX):
acc[i].append(0)
for a in A:
acc[i].append(acc[i][-1] + ((a >> i) & 1))
for _ in range(Q):
L, R = map(int, input().split())
ans = 0
for i in range(MAX):
x = acc[i][R] - acc[i][L - 1]
y = R - (L - 1) - x
ans += (1 << i) * x * y
print(ans)