結果
問題 | No.1201 お菓子配り-4 |
ユーザー | 👑 obakyan |
提出日時 | 2021-07-29 22:24:25 |
言語 | Lua (LuaJit 2.1.1696795921) |
結果 |
AC
|
実行時間 | 2,710 ms / 4,000 ms |
コード長 | 1,058 bytes |
コンパイル時間 | 107 ms |
コンパイル使用メモリ | 5,152 KB |
実行使用メモリ | 4,352 KB |
最終ジャッジ日時 | 2023-10-12 20:27:52 |
合計ジャッジ時間 | 18,741 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 50 ms
4,348 KB |
testcase_01 | AC | 646 ms
4,348 KB |
testcase_02 | AC | 1,195 ms
4,348 KB |
testcase_03 | AC | 447 ms
4,348 KB |
testcase_04 | AC | 219 ms
4,352 KB |
testcase_05 | AC | 539 ms
4,352 KB |
testcase_06 | AC | 83 ms
4,352 KB |
testcase_07 | AC | 252 ms
4,348 KB |
testcase_08 | AC | 678 ms
4,348 KB |
testcase_09 | AC | 654 ms
4,352 KB |
testcase_10 | AC | 5 ms
4,352 KB |
testcase_11 | AC | 131 ms
4,348 KB |
testcase_12 | AC | 1,045 ms
4,348 KB |
testcase_13 | AC | 30 ms
4,352 KB |
testcase_14 | AC | 16 ms
4,348 KB |
testcase_15 | AC | 821 ms
4,352 KB |
testcase_16 | AC | 251 ms
4,352 KB |
testcase_17 | AC | 323 ms
4,348 KB |
testcase_18 | AC | 53 ms
4,352 KB |
testcase_19 | AC | 51 ms
4,348 KB |
testcase_20 | AC | 1 ms
4,348 KB |
testcase_21 | AC | 1 ms
4,348 KB |
testcase_22 | AC | 1 ms
4,348 KB |
testcase_23 | AC | 1 ms
4,352 KB |
testcase_24 | AC | 1 ms
4,348 KB |
testcase_25 | AC | 1 ms
4,352 KB |
testcase_26 | AC | 1 ms
4,348 KB |
testcase_27 | AC | 1 ms
4,348 KB |
testcase_28 | AC | 1 ms
4,352 KB |
testcase_29 | AC | 1 ms
4,348 KB |
testcase_30 | AC | 1,312 ms
4,352 KB |
testcase_31 | AC | 1,326 ms
4,352 KB |
testcase_32 | AC | 1,722 ms
4,348 KB |
testcase_33 | AC | 1,375 ms
4,348 KB |
testcase_34 | AC | 1,326 ms
4,348 KB |
testcase_35 | AC | 2,710 ms
4,352 KB |
ソースコード
local mfl, mce = math.floor, math.ceil local mod = 1000000007 local half = 500000004 local z = 1000000000000000 local function bmul(x, y) if x * y < z then return (x * y) % mod end local x1, y1 = mfl(x / 31623), mfl(y / 31623) local x0, y0 = x - x1 * 31623, y - y1 * 31623 return (x1 * y1 * 14122 + (x1 * y0 + x0 * y1) * 31623 + x0 * y0) % mod end local function badd(x, y) return (x + y) % mod end local ret = 0 local function floorSum(n_m, m, a, b) while true do local n = n_m + m if m <= a then local v = mfl(a / m) ret = badd(ret, bmul(v, bmul(n, n - 1))) a = a % m end if m <= b then ret = badd(ret, bmul(2 * n, mfl(b / m))) b = b % m end if a == 0 then break end n_m, m, a, b = mfl((a * n_m + b) / m), a, m, (a * n_m + b) % m end end local n, m = io.read("*n", "*n") local a, b = {}, {} for i = 1, n do a[i] = io.read("*n") end for i = 1, m do b[i] = io.read("*n") end for i = 1, n do for j = 1, m do floorSum(1, b[j], a[i], 0) end end print(ret) -- print(os.clock())