結果
| 問題 |
No.989 N×Mマス計算(K以上)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-02-15 20:40:55 |
| 言語 | Lua (LuaJit 2.1.1734355927) |
| 結果 |
AC
|
| 実行時間 | 123 ms / 2,000 ms |
| コード長 | 534 bytes |
| コンパイル時間 | 305 ms |
| コンパイル使用メモリ | 7,076 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-06 14:03:22 |
| 合計ジャッジ時間 | 1,755 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 18 |
ソースコード
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)