結果
問題 | No.497 入れ子の箱 |
ユーザー |
|
提出日時 | 2017-03-25 00:30:34 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 342 ms / 5,000 ms |
コード長 | 722 bytes |
コンパイル時間 | 114 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 11,008 KB |
最終ジャッジ日時 | 2024-07-06 03:19:43 |
合計ジャッジ時間 | 9,068 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
import sys from operator import itemgetter def solve(): N = int(input()) hako = [sorted([int(i) for i in input().split()]) for j in range(N)] hako.sort() inf = 10**9 dp = [1] * N for i in range(N - 2, -1, -1): for j in range(i + 1, N): if is_larger(hako[i], hako[j]): dp[i] = max(dp[i], dp[j] + 1) ans = max(dp) print(ans) def is_larger(a, b): for i in range(3): if b[i] <= a[i]: return False return True def debug(x, table): for name, val in table.items(): if x is val: print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr) return None if __name__ == '__main__': solve()