結果
問題 | No.1071 ベホマラー |
ユーザー | 👑 obakyan |
提出日時 | 2020-06-05 23:28:45 |
言語 | Lua (LuaJit 2.1.1696795921) |
結果 |
AC
|
実行時間 | 82 ms / 2,000 ms |
コード長 | 694 bytes |
コンパイル時間 | 205 ms |
コンパイル使用メモリ | 5,296 KB |
実行使用メモリ | 6,504 KB |
最終ジャッジ日時 | 2023-08-22 18:04:09 |
合計ジャッジ時間 | 2,697 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,380 KB |
testcase_01 | AC | 1 ms
4,380 KB |
testcase_02 | AC | 1 ms
4,376 KB |
testcase_03 | AC | 1 ms
4,380 KB |
testcase_04 | AC | 1 ms
4,376 KB |
testcase_05 | AC | 1 ms
4,380 KB |
testcase_06 | AC | 1 ms
4,376 KB |
testcase_07 | AC | 1 ms
4,376 KB |
testcase_08 | AC | 1 ms
4,376 KB |
testcase_09 | AC | 1 ms
4,380 KB |
testcase_10 | AC | 71 ms
5,936 KB |
testcase_11 | AC | 65 ms
5,876 KB |
testcase_12 | AC | 43 ms
4,376 KB |
testcase_13 | AC | 57 ms
5,580 KB |
testcase_14 | AC | 70 ms
5,936 KB |
testcase_15 | AC | 82 ms
6,376 KB |
testcase_16 | AC | 80 ms
6,468 KB |
testcase_17 | AC | 81 ms
6,460 KB |
testcase_18 | AC | 81 ms
6,356 KB |
testcase_19 | AC | 80 ms
6,484 KB |
testcase_20 | AC | 69 ms
6,360 KB |
testcase_21 | AC | 70 ms
6,504 KB |
testcase_22 | AC | 69 ms
6,408 KB |
testcase_23 | AC | 69 ms
6,304 KB |
testcase_24 | AC | 80 ms
6,356 KB |
ソースコード
local mmi, mma = math.min, math.max local mfl, mce = math.floor, math.ceil local n, k = io.read("*n", "*n") local x, y = io.read("*n", "*n") local t = {} for i = 1, n do local a = io.read("*n") t[i] = mce((a - 1) / k) end table.sort(t) local lim = mce(y / x) lim = mmi(lim, n + 1) k = 0LL + k x, y = 0LL + x, 0LL + y local ret = 0LL local cursum = 0LL for i = 1, n do t[i] = 0LL + t[i] end for i = 1, n + 1 - lim do if cursum < t[i] then local rem = t[i] - cursum ret = ret + rem * y cursum = cursum + rem end end for i = n + 2 - lim, n do local rem = t[i] - cursum if 0 < rem then ret = ret + rem * x end end local str = tostring(ret):gsub("LL", "") print(str)