結果
| 問題 |
No.1792 科学の甲子園
|
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 14:11:18 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,020 bytes |
| コンパイル時間 | 253 ms |
| コンパイル使用メモリ | 82,244 KB |
| 実行使用メモリ | 79,392 KB |
| 最終ジャッジ日時 | 2025-06-12 14:11:46 |
| 合計ジャッジ時間 | 3,955 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 WA * 3 |
ソースコード
import itertools
n = int(input())
students = []
for _ in range(n):
m, i, p, c, b, e = map(int, input().split())
students.append((m, i, p, c, b, e))
k = 5 # Number of top students to consider per subject
candidates = set()
for subject in range(6):
sorted_students = sorted([(idx, s[subject]) for idx, s in enumerate(students)],
key=lambda x: (-x[1], x[0]))
for i in range(min(k, len(sorted_students))):
candidates.add(sorted_students[i][0])
candidate_list = list(candidates)
max_score = 0
for group in itertools.combinations(candidate_list, 4):
m_max = max(students[i][0] for i in group)
i_max = max(students[i][1] for i in group)
p_max = max(students[i][2] for i in group)
c_max = max(students[i][3] for i in group)
b_max = max(students[i][4] for i in group)
e_max = max(students[i][5] for i in group)
product = m_max * i_max * p_max * c_max * b_max * e_max
if product > max_score:
max_score = product
print(max_score)
gew1fw