結果
| 問題 |
No.1792 科学の甲子園
|
| コンテスト | |
| ユーザー |
H20
|
| 提出日時 | 2021-12-21 00:43:58 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 90 ms / 4,000 ms |
| コード長 | 1,258 bytes |
| コンパイル時間 | 151 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 76,928 KB |
| 最終ジャッジ日時 | 2024-11-26 17:53:38 |
| 合計ジャッジ時間 | 2,742 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 |
ソースコード
import itertools
N = int(input())
ALL = []
MIPCBE = [0]*6
for _ in range(N):
L = list(map(int, input().split()))
ALL.append(L)
for i in range(6):
MIPCBE[i] = max(MIPCBE[i],L[i])
ans = 0
for l in list(itertools.combinations(range(6), 3)):
OTHER = list(range(6))
for i in l:
OTHER.remove(i)
v = 1
for o in OTHER:
v *= MIPCBE[o]
v2 = 1
for mipcbe in ALL:
temp=1
for i in l:
temp*=mipcbe[i]
v2 = max(temp,v2)
ans = max(ans,v*v2)
for l in list(itertools.combinations(range(6), 4)):
OTHER = list(range(6))
for i in l:
OTHER.remove(i)
v = 1
for o in OTHER:
v *= MIPCBE[o]
for i in range(1,4):
l1 = [0,i]
l2 = []
for j in range(1,4):
if j not in l1:
l2.append(j)
ll1 = [l[l1[0]],l[l1[1]]]
ll2 = [l[l2[0]],l[l2[1]]]
v2 = 1
for mipcbe in ALL:
temp=1
for i in ll1:
temp*=mipcbe[i]
v2 = max(temp,v2)
v3 = 1
for mipcbe in ALL:
temp=1
for i in ll2:
temp*=mipcbe[i]
v3 = max(temp,v3)
ans = max(ans,v*v2*v3)
print(ans)
H20