結果
問題 | No.1742 Binary Indexed Train |
ユーザー | Navier_Boltzmann |
提出日時 | 2024-01-07 18:54:38 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 675 bytes |
コンパイル時間 | 276 ms |
コンパイル使用メモリ | 81,828 KB |
実行使用メモリ | 77,956 KB |
最終ジャッジ日時 | 2024-01-07 18:54:52 |
合計ジャッジ時間 | 13,175 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 43 ms
55,604 KB |
testcase_01 | AC | 43 ms
55,604 KB |
testcase_02 | AC | 43 ms
55,604 KB |
testcase_03 | RE | - |
testcase_04 | RE | - |
testcase_05 | RE | - |
testcase_06 | AC | 376 ms
76,940 KB |
testcase_07 | AC | 343 ms
76,940 KB |
testcase_08 | AC | 529 ms
77,696 KB |
testcase_09 | AC | 531 ms
77,572 KB |
testcase_10 | AC | 528 ms
77,692 KB |
testcase_11 | AC | 533 ms
77,576 KB |
testcase_12 | AC | 522 ms
77,556 KB |
testcase_13 | AC | 370 ms
76,516 KB |
testcase_14 | AC | 359 ms
76,520 KB |
testcase_15 | AC | 210 ms
77,844 KB |
testcase_16 | AC | 183 ms
77,568 KB |
testcase_17 | AC | 430 ms
77,840 KB |
testcase_18 | AC | 388 ms
77,952 KB |
testcase_19 | AC | 282 ms
77,840 KB |
testcase_20 | AC | 133 ms
77,708 KB |
testcase_21 | AC | 229 ms
77,696 KB |
testcase_22 | AC | 440 ms
77,828 KB |
testcase_23 | AC | 142 ms
77,836 KB |
testcase_24 | AC | 112 ms
77,056 KB |
testcase_25 | AC | 329 ms
77,708 KB |
testcase_26 | AC | 297 ms
77,952 KB |
testcase_27 | AC | 311 ms
77,828 KB |
testcase_28 | AC | 148 ms
77,956 KB |
testcase_29 | AC | 414 ms
77,832 KB |
testcase_30 | AC | 218 ms
77,936 KB |
testcase_31 | AC | 406 ms
77,808 KB |
testcase_32 | AC | 212 ms
77,808 KB |
testcase_33 | AC | 153 ms
77,680 KB |
testcase_34 | AC | 297 ms
77,808 KB |
ソースコード
from collections import * from itertools import * from functools import * from heapq import * import sys,math input = sys.stdin.readline N,Q = map(int,input().split()) def solve(s,t): S = [] T = [] for i in range(60): if (s>>i)&1: S.append(i) if (t>>i)&1: T.append(i) if len(S) == 0: return len(T) while S[-1]==T[-1]: S.pop() T.pop() if len(S)==0: break if len(S) == 0: return len(T) cost = T[-1] - S[0] - (len(S) - 1) cost += (len(T)-1) return cost for _ in range(Q): s,t = map(int,input().split()) print(solve(s,t),flush=True)