結果

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

ソースコード

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