結果

問題 No.714 回転寿司屋のシミュレート
ユーザー 👑 obakyanobakyan
提出日時 2019-04-27 22:51:49
言語 Lua
(LuaJit 2.1.1696795921)
結果
AC  
実行時間 7 ms / 2,000 ms
コード長 901 bytes
コンパイル時間 141 ms
コンパイル使用メモリ 5,304 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-08-20 00:16:35
合計ジャッジ時間 1,968 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,504 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 3 ms
4,380 KB
testcase_06 AC 4 ms
4,376 KB
testcase_07 AC 5 ms
4,380 KB
testcase_08 AC 7 ms
4,376 KB
testcase_09 AC 4 ms
4,376 KB
testcase_10 AC 3 ms
4,376 KB
testcase_11 AC 3 ms
4,376 KB
testcase_12 AC 4 ms
4,376 KB
testcase_13 AC 3 ms
4,376 KB
testcase_14 AC 4 ms
4,376 KB
testcase_15 AC 3 ms
4,380 KB
testcase_16 AC 3 ms
4,376 KB
testcase_17 AC 3 ms
4,380 KB
testcase_18 AC 3 ms
4,380 KB
testcase_19 AC 3 ms
4,376 KB
testcase_20 AC 3 ms
4,376 KB
testcase_21 AC 4 ms
4,376 KB
testcase_22 AC 3 ms
4,376 KB
testcase_23 AC 3 ms
4,376 KB
testcase_24 AC 3 ms
4,380 KB
testcase_25 AC 3 ms
4,380 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 3 ms
4,380 KB
testcase_28 AC 3 ms
4,376 KB
testcase_29 AC 2 ms
4,380 KB
testcase_30 AC 1 ms
4,380 KB
testcase_31 AC 1 ms
4,380 KB
testcase_32 AC 1 ms
4,376 KB
testcase_33 AC 1 ms
4,380 KB
testcase_34 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

ior = io.read
local n = ior("*n", "*l")
local sekilist = {}
for i = 1, 20 do
  sekilist[i] = {}
end
for i = 1, n do
  local q = ior("*n")
  if(q == 0) then
    local seki, c, str = ior("*n", "*n", "*l")
    --print(seki, c, str)
    local netas = {}
    for neta in str:gmatch("%w+") do
      if(netas[neta] == nil) then netas[neta] = 1 else netas[neta] = netas[neta] + 1 end
    end
    sekilist[seki] = netas
  elseif(q == 1) then
    local _, neta = ior(1, "*l")
    local found = false
    for j = 1, 20 do
      if(sekilist[j][neta] ~= nil) then
        print(j)
        if(sekilist[j][neta] == 1) then
          sekilist[j][neta] = nil
        else
          sekilist[j][neta] = sekilist[j][neta] - 1
        end
        found = true
        break
      end
    end
    if(not found) then print(-1) end
  else
    local seki = ior("*n", "*l")
    --print(seki)
    sekilist[seki] = {}
  end
end
0