結果

問題 No.497 入れ子の箱
ユーザー 0w10w1
提出日時 2017-04-10 18:37:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 162 ms / 5,000 ms
コード長 683 bytes
コンパイル時間 365 ms
コンパイル使用メモリ 87,056 KB
実行使用メモリ 80,332 KB
最終ジャッジ日時 2023-09-25 06:49:22
合計ジャッジ時間 6,647 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 100 ms
72,776 KB
testcase_01 AC 99 ms
72,884 KB
testcase_02 AC 100 ms
72,752 KB
testcase_03 AC 161 ms
79,996 KB
testcase_04 AC 142 ms
79,964 KB
testcase_05 AC 143 ms
79,804 KB
testcase_06 AC 147 ms
80,008 KB
testcase_07 AC 146 ms
79,788 KB
testcase_08 AC 144 ms
80,084 KB
testcase_09 AC 143 ms
79,608 KB
testcase_10 AC 144 ms
79,800 KB
testcase_11 AC 147 ms
79,876 KB
testcase_12 AC 158 ms
80,332 KB
testcase_13 AC 153 ms
79,828 KB
testcase_14 AC 158 ms
80,012 KB
testcase_15 AC 156 ms
80,180 KB
testcase_16 AC 153 ms
79,756 KB
testcase_17 AC 162 ms
79,996 KB
testcase_18 AC 156 ms
80,116 KB
testcase_19 AC 154 ms
80,028 KB
testcase_20 AC 157 ms
79,924 KB
testcase_21 AC 153 ms
80,272 KB
testcase_22 AC 154 ms
79,896 KB
testcase_23 AC 132 ms
78,288 KB
testcase_24 AC 127 ms
78,360 KB
testcase_25 AC 101 ms
72,996 KB
testcase_26 AC 99 ms
72,568 KB
testcase_27 AC 153 ms
79,764 KB
testcase_28 AC 156 ms
79,604 KB
testcase_29 AC 151 ms
79,968 KB
testcase_30 AC 150 ms
79,732 KB
testcase_31 AC 144 ms
79,892 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
from functools import cmp_to_key
N = int( input() )
X = []
Y = []
Z = []
for i in range( N ):
  x, y, z = sorted( list( map( int, input().split() ) ) )
  X.append( x )
  Y.append( y )
  Z.append( z )
ord = sorted( list( i for i in range( N ) ), key = cmp_to_key( lambda x, y: 0 if X[ x ] == X[ y ] else ( X[ x ] - X[ y ] ) // abs( X[ x ] - X[ y ] ) ) )
dp = defaultdict( int )
for i in range( N ):
  best = 0
  for j in range( i ):
    a, b = ord[ i ], ord[ j ]
    if X[ b ] < X[ a ] and Y[ b ] < Y[ a ] and Z[ b ] < Z[ a ]:
      best = max( best, dp[ j ] )
  dp[ i ] = best + 1
ans = 0
for key in dp:
  ans = max( ans, dp[ key ] )
print( ans )
0