結果
問題 | No.1742 Binary Indexed Train |
ユーザー | Navier_Boltzmann |
提出日時 | 2024-01-07 18:55:34 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 540 ms / 3,000 ms |
コード長 | 675 bytes |
コンパイル時間 | 323 ms |
コンパイル使用メモリ | 81,572 KB |
実行使用メモリ | 78,064 KB |
最終ジャッジ日時 | 2024-01-07 18:55:48 |
合計ジャッジ時間 | 13,403 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 44 ms
55,604 KB |
testcase_01 | AC | 44 ms
55,604 KB |
testcase_02 | AC | 45 ms
55,604 KB |
testcase_03 | AC | 493 ms
77,536 KB |
testcase_04 | AC | 433 ms
77,680 KB |
testcase_05 | AC | 460 ms
77,804 KB |
testcase_06 | AC | 363 ms
77,068 KB |
testcase_07 | AC | 341 ms
76,940 KB |
testcase_08 | AC | 531 ms
77,436 KB |
testcase_09 | AC | 540 ms
77,564 KB |
testcase_10 | AC | 530 ms
77,560 KB |
testcase_11 | AC | 540 ms
77,696 KB |
testcase_12 | AC | 522 ms
77,696 KB |
testcase_13 | AC | 357 ms
76,516 KB |
testcase_14 | AC | 367 ms
76,512 KB |
testcase_15 | AC | 213 ms
77,828 KB |
testcase_16 | AC | 181 ms
77,580 KB |
testcase_17 | AC | 429 ms
77,832 KB |
testcase_18 | AC | 409 ms
77,832 KB |
testcase_19 | AC | 289 ms
77,840 KB |
testcase_20 | AC | 137 ms
77,720 KB |
testcase_21 | AC | 243 ms
77,704 KB |
testcase_22 | AC | 457 ms
77,684 KB |
testcase_23 | AC | 144 ms
77,840 KB |
testcase_24 | AC | 112 ms
77,056 KB |
testcase_25 | AC | 341 ms
77,680 KB |
testcase_26 | AC | 312 ms
77,844 KB |
testcase_27 | AC | 309 ms
77,828 KB |
testcase_28 | AC | 147 ms
77,956 KB |
testcase_29 | AC | 415 ms
77,700 KB |
testcase_30 | AC | 229 ms
77,808 KB |
testcase_31 | AC | 414 ms
77,808 KB |
testcase_32 | AC | 219 ms
77,680 KB |
testcase_33 | AC | 156 ms
77,936 KB |
testcase_34 | AC | 322 ms
78,064 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(61): 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)