結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 6 ms
5,376 KB
testcase_04 AC 6 ms
5,376 KB
testcase_05 AC 6 ms
5,376 KB
testcase_06 AC 6 ms
5,376 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 4 ms
5,376 KB
testcase_24 AC 4 ms
5,376 KB
testcase_25 AC 2 ms
5,376 KB
testcase_26 AC 1 ms
5,376 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 9 ms
5,376 KB
testcase_31 AC 9 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, y 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