結果

問題 No.497 入れ子の箱
ユーザー 👑 obakyanobakyan
提出日時 2020-04-22 09:05:10
言語 Lua
(LuaJit 2.1.1696795921)
結果
AC  
実行時間 14 ms / 5,000 ms
コード長 709 bytes
コンパイル時間 118 ms
コンパイル使用メモリ 5,248 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-19 07:32:52
合計ジャッジ時間 1,270 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

local mma = math.max
local n = io.read("*n")
local t = {}
for i = 1, n do
  local x, y, z = io.read("*n", "*n", "*n")
  if y < x then x, y = y, x end
  if z < x then x, z = z, x end
  if z < y then y, z = z, y end
  t[i] = {x, y, z}
end
local function sortfunc(a, b)
  if a[1] ~= b[1] then
    return a[1] < b[1]
  elseif a[2] ~= b[2] then
    return a[2] < b[2]
  else
    return a[3] < b[3]
  end
end
table.sort(t, sortfunc)
local v = {}
v[1] = 1
for i = 2, n do
  local cand = 1
  for j = 1, i - 1 do
    if t[j][1] < t[i][1] and t[j][2] < t[i][2] and t[j][3] < t[i][3] then
      cand = mma(cand, v[j] + 1)
    end
  end
  v[i] = cand
end
local ret = 1
for i = 1, n do ret = mma(ret, v[i]) end
print(ret)
0