結果

問題 No.1742 Binary Indexed Train
ユーザー NatsubiSoganNatsubiSogan
提出日時 2021-11-14 18:02:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 430 ms / 3,000 ms
コード長 223 bytes
コンパイル時間 1,230 ms
コンパイル使用メモリ 86,760 KB
実行使用メモリ 77,624 KB
最終ジャッジ日時 2023-08-20 01:37:30
合計ジャッジ時間 12,941 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,216 KB
testcase_01 AC 76 ms
71,060 KB
testcase_02 AC 80 ms
71,192 KB
testcase_03 AC 388 ms
77,116 KB
testcase_04 AC 363 ms
76,852 KB
testcase_05 AC 369 ms
76,936 KB
testcase_06 AC 335 ms
77,624 KB
testcase_07 AC 313 ms
77,228 KB
testcase_08 AC 418 ms
77,052 KB
testcase_09 AC 416 ms
77,044 KB
testcase_10 AC 422 ms
76,960 KB
testcase_11 AC 430 ms
76,940 KB
testcase_12 AC 427 ms
76,656 KB
testcase_13 AC 334 ms
76,824 KB
testcase_14 AC 347 ms
76,832 KB
testcase_15 AC 167 ms
76,784 KB
testcase_16 AC 140 ms
77,020 KB
testcase_17 AC 319 ms
77,168 KB
testcase_18 AC 319 ms
77,116 KB
testcase_19 AC 224 ms
76,928 KB
testcase_20 AC 105 ms
76,452 KB
testcase_21 AC 184 ms
77,280 KB
testcase_22 AC 335 ms
76,880 KB
testcase_23 AC 111 ms
76,660 KB
testcase_24 AC 101 ms
76,660 KB
testcase_25 AC 264 ms
76,720 KB
testcase_26 AC 243 ms
77,024 KB
testcase_27 AC 243 ms
76,968 KB
testcase_28 AC 118 ms
77,172 KB
testcase_29 AC 312 ms
76,876 KB
testcase_30 AC 187 ms
77,124 KB
testcase_31 AC 348 ms
77,120 KB
testcase_32 AC 177 ms
76,952 KB
testcase_33 AC 124 ms
76,884 KB
testcase_34 AC 251 ms
76,968 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, q = map(int, input().split())
for _ in range(q):
	s, t = map(int, input().split())
	ans = 0
	s += 1 << n; t += 1 << n
	while s < t:
		if s & 1: ans += 1; s += 1
		if t & 1: ans += 1; t -= 1
		s >>= 1; t >>= 1
	print(ans)
0