結果
問題 |
No.1742 Binary Indexed Train
|
ユーザー |
|
提出日時 | 2021-10-13 08:57:09 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 527 bytes |
コンパイル時間 | 164 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 91,588 KB |
最終ジャッジ日時 | 2024-11-25 10:53:59 |
合計ジャッジ時間 | 9,967 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | WA * 32 |
ソースコード
def solve(n, q, st): answer = [] for s, t in st: ans = 0 term = 0 for j in range(32, -1, -1): if (not((s >> j) & 1)) and (t >> j) & 1: mid = 2 ** j * (s // (2 ** j)) + 2 ** j break ans = bin(2 ** 32 - s).count('1') + bin(2 ** 32 - t).count('1') answer.append(ans) return answer n, q = map(int,input().split()) st = [list(map(int,input().split())) for _ in range(q)] answer = solve(n, q, st) for i in answer: print(i)