結果

問題 No.989 N×Mマス計算(K以上)
ユーザー 👑 obakyanobakyan
提出日時 2020-02-15 20:40:55
言語 Lua
(LuaJit 2.1.1696795921)
結果
AC  
実行時間 125 ms / 2,000 ms
コード長 534 bytes
コンパイル時間 289 ms
コンパイル使用メモリ 5,504 KB
実行使用メモリ 6,540 KB
最終ジャッジ日時 2024-04-16 03:17:28
合計ジャッジ時間 1,632 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 75 ms
5,376 KB
testcase_11 AC 79 ms
5,456 KB
testcase_12 AC 89 ms
5,592 KB
testcase_13 AC 50 ms
5,376 KB
testcase_14 AC 125 ms
6,540 KB
testcase_15 AC 31 ms
5,376 KB
testcase_16 AC 61 ms
5,376 KB
testcase_17 AC 50 ms
5,376 KB
testcase_18 AC 42 ms
5,376 KB
testcase_19 AC 81 ms
5,500 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

local n, m, k = io.read("*n", "*n", "*n", "*l")
local str = io.read()
local op = str:sub(1, 1)
local b = {}
for s in str:gmatch("(%d+)") do
  table.insert(b, tonumber(s))
end
table.sort(b)
local a = {}
for i = 1, n do
  a[i] = io.read("*n")
end
table.sort(a)
local cur_i = n
local cnt = 0
for j = 1, m do
  while true do
    if cur_i == 0 then break end
    local z = op == "*" and a[cur_i] * b[j] or a[cur_i] + b[j]
    if k <= z then
      cur_i = cur_i - 1
    else
      break
    end
  end
  cnt = cnt + n - cur_i
end
print(cnt)
0