結果
問題 |
No.1742 Binary Indexed Train
|
ユーザー |
👑 ![]() |
提出日時 | 2022-04-13 00:47:58 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 477 bytes |
コンパイル時間 | 176 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 33,440 KB |
最終ジャッジ日時 | 2024-12-21 13:26:39 |
合計ジャッジ時間 | 65,294 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 TLE * 11 |
ソースコード
def solve(S,T,l,r): if T<=l or r<=S: return 0 elif S<=l and r<=T: return 1 else: m=(l+r)>>1 x=solve(S,T,l,m) y=solve(S,T,m,r) return x+y #================================================ import sys input=sys.stdin.readline write=sys.stdout.write N,Q=map(int,input().split()) Max=1<<N Ans=[0]*Q for quest in range(Q): S,T=map(int,input().split()) Ans[quest]=solve(S,T,0,Max) write("\n".join(map(str,Ans)))