結果

問題 No.1742 Binary Indexed Train
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2021-11-12 23:25:12
言語 PyPy3
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 374 bytes
コンパイル時間 342 ms
コンパイル使用メモリ 87,140 KB
実行使用メモリ 105,448 KB
最終ジャッジ日時 2023-08-17 04:06:52
合計ジャッジ時間 18,960 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,444 KB
testcase_01 AC 71 ms
71,276 KB
testcase_02 AC 70 ms
71,596 KB
testcase_03 AC 2,948 ms
94,052 KB
testcase_04 AC 2,190 ms
92,464 KB
testcase_05 AC 2,218 ms
92,500 KB
testcase_06 AC 371 ms
79,928 KB
testcase_07 AC 372 ms
79,468 KB
testcase_08 TLE -
testcase_09 TLE -
testcase_10 TLE -
testcase_11 TLE -
testcase_12 TLE -
testcase_13 AC 2,075 ms
92,196 KB
testcase_14 AC 2,097 ms
91,904 KB
testcase_15 AC 570 ms
81,428 KB
testcase_16 AC 600 ms
83,752 KB
testcase_17 AC 1,107 ms
81,456 KB
testcase_18 AC 1,170 ms
82,904 KB
testcase_19 AC 519 ms
80,688 KB
testcase_20 AC 159 ms
78,424 KB
testcase_21 AC 552 ms
80,260 KB
testcase_22 AC 1,363 ms
83,812 KB
testcase_23 AC 250 ms
79,600 KB
testcase_24 AC 179 ms
80,396 KB
testcase_25 AC 1,692 ms
91,680 KB
testcase_26 AC 658 ms
80,900 KB
testcase_27 AC 1,444 ms
88,776 KB
testcase_28 AC 215 ms
78,984 KB
testcase_29 AC 1,549 ms
86,140 KB
testcase_30 AC 1,031 ms
82,404 KB
testcase_31 AC 2,032 ms
91,632 KB
testcase_32 AC 792 ms
82,500 KB
testcase_33 AC 372 ms
80,120 KB
testcase_34 AC 1,856 ms
88,112 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(3*10**5)
def solve(s,t,l,r):
    if t <= l or r <= s:
        return 0

    elif s <= l and r <= t:
        return 1
    else:
        m =(r+l)>>1
        x = solve(s,t,l,m)
        y = solve(s,t,m,r)
        return x+y

n,q = map(int,input().split())
M = 1<<n
for i in range(q):
    s,t = map(int,input().split())
    print(solve(s,t,0,M))
0