結果

問題 No.1742 Binary Indexed Train
コンテスト
ユーザー NatsubiSogan
提出日時 2021-11-14 18:02:35
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
TLE  
実行時間 -
コード長 223 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 784 ms
コンパイル使用メモリ 20,848 KB
実行使用メモリ 15,488 KB
最終ジャッジ日時 2026-05-23 17:30:01
合計ジャッジ時間 12,473 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6 TLE * 3 -- * 23
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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