結果
| 問題 |
No.1742 Binary Indexed Train
|
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2022-01-16 20:01:38 |
| 言語 | Lua (LuaJit 2.1.1734355927) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 517 bytes |
| コンパイル時間 | 310 ms |
| コンパイル使用メモリ | 5,504 KB |
| 実行使用メモリ | 10,624 KB |
| 最終ジャッジ日時 | 2024-11-23 12:06:37 |
| 合計ジャッジ時間 | 53,741 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 TLE * 7 |
ソースコード
local ffi = require("ffi")
local C = ffi.C
ffi.cdef[[
long long atoll(const char*);
]]
local function lltonumber(str)
return C.atoll(str)
end
local n, q = io.read("*n", "*n", "*l")
for iq = 1, q do
local s, t = io.read():match("(%d+) (%d+)")
s = lltonumber(s)
t = lltonumber(t)
local z = 0
while 0LL < t - s do
local len = t - s
local jump1 = 1LL
while s % (2LL * jump1) == 0LL and jump1 * 2LL <= len do
jump1 = jump1 * 2LL
end
z = z + 1
s = s + jump1
end
print(z)
end