結果
問題 | No.1742 Binary Indexed Train |
ユーザー |
![]() |
提出日時 | 2021-11-12 22:54:05 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 2,348 ms / 3,000 ms |
コード長 | 477 bytes |
コンパイル時間 | 309 ms |
コンパイル使用メモリ | 82,268 KB |
実行使用メモリ | 112,096 KB |
最終ジャッジ日時 | 2024-11-25 20:49:57 |
合計ジャッジ時間 | 33,771 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 |
ソースコード
""" """ import sys from sys import stdin def solve(a,b,l,r): if r <= a or b <= l: return 0 if a <= l and r <= b: #print (l,r) return 1 else: c1 = solve(a,b,l,(l+r)//2) c2 = solve(a,b,(l+r)//2,r) return c1 + c2 N,Q = map(int,stdin.readline().split()) ANS = [] for i in range(Q): S,T = map(int,stdin.readline().split()) #T -= 1 ANS.append( solve(S,T,0,2**N) ) print ("\n".join(map(str,ANS)))