結果

問題 No.1792 科学の甲子園
ユーザー lam6er
提出日時 2025-04-15 23:34:00
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 939 bytes
コンパイル時間 149 ms
コンパイル使用メモリ 81,940 KB
実行使用メモリ 75,936 KB
最終ジャッジ日時 2025-04-15 23:35:09
合計ジャッジ時間 2,673 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

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))

subjects = [0, 1, 2, 3, 4, 5]  # M, I, P, C, B, E

candidates = set()

for subject in subjects:
    sorted_students = sorted(enumerate(students), key=lambda x: x[1][subject], reverse=True)
    top = min(5, len(sorted_students))
    for i in range(top):
        candidates.add(sorted_students[i][0])

candidates = list(candidates)
max_score = 0

for group in itertools.combinations(candidates, 4):
    max_values = [0] * 6
    for subject in subjects:
        max_val = 0
        for member in group:
            val = students[member][subject]
            if val > max_val:
                max_val = val
        max_values[subject] = max_val
    product = 1
    for val in max_values:
        product *= val
    if product > max_score:
        max_score = product

print(max_score)
0