結果

問題 No.497 入れ子の箱
ユーザー 6soukiti296soukiti29
提出日時 2017-03-26 07:21:07
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,215 ms / 5,000 ms
コード長 510 bytes
コンパイル時間 89 ms
コンパイル使用メモリ 10,784 KB
実行使用メモリ 8,760 KB
最終ジャッジ日時 2023-09-20 10:13:39
合計ジャッジ時間 9,531 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,160 KB
testcase_01 AC 16 ms
8,300 KB
testcase_02 AC 17 ms
8,192 KB
testcase_03 AC 63 ms
8,568 KB
testcase_04 AC 63 ms
8,636 KB
testcase_05 AC 62 ms
8,760 KB
testcase_06 AC 65 ms
8,684 KB
testcase_07 AC 64 ms
8,732 KB
testcase_08 AC 65 ms
8,564 KB
testcase_09 AC 65 ms
8,588 KB
testcase_10 AC 63 ms
8,680 KB
testcase_11 AC 64 ms
8,588 KB
testcase_12 AC 324 ms
8,540 KB
testcase_13 AC 342 ms
8,532 KB
testcase_14 AC 361 ms
8,608 KB
testcase_15 AC 309 ms
8,604 KB
testcase_16 AC 318 ms
8,600 KB
testcase_17 AC 345 ms
8,564 KB
testcase_18 AC 65 ms
8,580 KB
testcase_19 AC 66 ms
8,548 KB
testcase_20 AC 67 ms
8,732 KB
testcase_21 AC 66 ms
8,548 KB
testcase_22 AC 66 ms
8,680 KB
testcase_23 AC 1,032 ms
8,456 KB
testcase_24 AC 1,066 ms
8,496 KB
testcase_25 AC 16 ms
8,352 KB
testcase_26 AC 15 ms
8,188 KB
testcase_27 AC 198 ms
8,528 KB
testcase_28 AC 202 ms
8,696 KB
testcase_29 AC 196 ms
8,704 KB
testcase_30 AC 1,172 ms
8,560 KB
testcase_31 AC 1,215 ms
8,572 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools
N = int(input())
A = []
for n in range(N):
	X,Y,Z = map(int,input().split())
	V = X*Y*Z
	A.append([X,Y,Z,V])
A.sort(key = lambda x: - x[3])
B = [[float("inf") for i in range(3)] + [0]]
for a in A:
	for b in B:
		P = 0
		bx,by,bz = b[:-1]
		ax,ay,az = a[:-1]
		Ap = list(itertools.permutations([ax,ay,az],3))
		for p in Ap:
			if p[0] < bx and p[1] < by and p[2] < bz:
				 P = 1
				 break
		if P == 1:
			B.append(a[:-1] + [b[3] + 1])
			B.sort(key = lambda x: - x[3])
			break
print(B[0][3])
0