結果

問題 No.497 入れ子の箱
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2023-12-02 15:05:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 119 ms / 5,000 ms
コード長 777 bytes
コンパイル時間 168 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 80,632 KB
最終ジャッジ日時 2023-12-02 15:05:52
合計ジャッジ時間 4,770 ms
ジャッジサーバーID
(参考情報)
judge9 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
55,604 KB
testcase_01 AC 47 ms
55,604 KB
testcase_02 AC 47 ms
55,604 KB
testcase_03 AC 104 ms
80,504 KB
testcase_04 AC 105 ms
80,504 KB
testcase_05 AC 103 ms
80,504 KB
testcase_06 AC 104 ms
80,496 KB
testcase_07 AC 105 ms
80,496 KB
testcase_08 AC 106 ms
80,504 KB
testcase_09 AC 103 ms
80,632 KB
testcase_10 AC 103 ms
80,624 KB
testcase_11 AC 104 ms
80,496 KB
testcase_12 AC 118 ms
77,216 KB
testcase_13 AC 119 ms
77,228 KB
testcase_14 AC 117 ms
77,228 KB
testcase_15 AC 116 ms
77,216 KB
testcase_16 AC 119 ms
77,216 KB
testcase_17 AC 119 ms
77,108 KB
testcase_18 AC 109 ms
80,248 KB
testcase_19 AC 109 ms
80,376 KB
testcase_20 AC 110 ms
80,376 KB
testcase_21 AC 109 ms
80,376 KB
testcase_22 AC 109 ms
80,248 KB
testcase_23 AC 65 ms
66,504 KB
testcase_24 AC 65 ms
66,500 KB
testcase_25 AC 46 ms
55,604 KB
testcase_26 AC 46 ms
55,604 KB
testcase_27 AC 112 ms
77,444 KB
testcase_28 AC 114 ms
77,320 KB
testcase_29 AC 112 ms
77,320 KB
testcase_30 AC 87 ms
70,792 KB
testcase_31 AC 95 ms
72,872 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *
from itertools import *
from functools import *
from heapq import *
import sys,math
input = sys.stdin.readline

N = int(input())
XYZ = []
for _ in range(N):
    X = list(map(int,input().split()))
    X.sort()
    XYZ.append(tuple(X))
    
ind = [0]*N
e = [[] for _ in range(N)]
for i in range(N):
    xi,yi,zi = XYZ[i]
    for j in range(N):
        xj,yj,zj = XYZ[j]
        if (xi<xj)&(yi<yj)&(zi<zj):
            e[i].append(j)
            ind[j] += 1

v = deque()
val = [0]*N
for i in range(N):
    if ind[i]==0:
        v.append(i)
        val[i] = 1

while v:
    
    x = v.popleft()
    
    for ix in e[x]:
        
        val[ix] = max(val[x] + 1,val[ix])
        ind[ix] -= 1
        if ind[ix]==0:
            v.append(ix)
print(max(val))
0