結果
| 問題 |
No.497 入れ子の箱
|
| ユーザー |
titia
|
| 提出日時 | 2023-06-28 00:07:44 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 1,098 ms / 5,000 ms |
| コード長 | 582 bytes |
| コンパイル時間 | 82 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 32,128 KB |
| 最終ジャッジ日時 | 2024-07-04 16:23:27 |
| 合計ジャッジ時間 | 25,225 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
N=int(input())
B=[list(map(int,input().split())) for i in range(N)]
E=[[] for i in range(N)]
E_INV=[[] for i in range(N)]
D=[0]*N
for i in range(N):
X=sorted(B[i])
for j in range(N):
Y=sorted(B[j])
if Y[0]<X[0] and Y[1]<X[1] and Y[2]<X[2]:
E[i].append(j)
E_INV[j].append(i)
D[i]+=1
Q=[]
DP=[1]*N
for i in range(N):
if D[i]==0:
Q.append(i)
while Q:
x=Q.pop()
for to in E_INV[x]:
DP[to]=max(DP[to],DP[x]+1)
D[to]-=1
if D[to]==0:
Q.append(to)
print(max(DP))
titia