結果
問題 | No.1742 Binary Indexed Train |
ユーザー |
![]() |
提出日時 | 2021-11-14 22:37:15 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 269 ms / 3,000 ms |
コード長 | 865 bytes |
コンパイル時間 | 161 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 79,072 KB |
最終ジャッジ日時 | 2024-11-30 08:23:48 |
合計ジャッジ時間 | 9,624 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 |
ソースコード
#!usr/bin/env python3from collections import defaultdict, dequefrom heapq import heappush, heappopfrom itertools import permutations, accumulateimport sysimport mathimport bisectdef LI(): return [int(x) for x in sys.stdin.readline().split()]def I(): return int(sys.stdin.readline())def IR(n):return [I() for _ in range(n)]def LIR(n):return [LI() for _ in range(n)]sys.setrecursionlimit(1000000)mod = 1000000007def main():def f(l,r):l += 2**nr += 2**nres = 0while l < r:if l & 1:res +=1l += 1if r & 1:r -= 1res += 1l >>= 1r >>= 1return resn,q = LI()for _ in range(q):l,r = LI()print(f(l,r))returnif __name__ == "__main__":main()