結果
| 問題 | No.1792 科学の甲子園 | 
| コンテスト | |
| ユーザー |  gew1fw | 
| 提出日時 | 2025-06-12 19:09:13 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 1,132 bytes | 
| コンパイル時間 | 540 ms | 
| コンパイル使用メモリ | 82,464 KB | 
| 実行使用メモリ | 77,344 KB | 
| 最終ジャッジ日時 | 2025-06-12 19:09:17 | 
| 合計ジャッジ時間 | 4,040 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| 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))
# Collect top 5 candidates for each subject
subjects = [0, 1, 2, 3, 4, 5]  # Indices for M, I, P, C, B, E
candidate_indices = set()
for subj in subjects:
    # Sort students by the current subject in descending order and take top 5
    sorted_indices = sorted(range(n), key=lambda x: students[x][subj], reverse=True)
    top_indices = sorted_indices[:5]
    candidate_indices.update(top_indices)
# Convert indices to actual student data
candidates = [students[i] for i in candidate_indices]
max_score = 0
# Generate all combinations of 4 students from candidates
for group in itertools.combinations(candidates, 4):
    m_max = max(s[0] for s in group)
    i_max = max(s[1] for s in group)
    p_max = max(s[2] for s in group)
    c_max = max(s[3] for s in group)
    b_max = max(s[4] for s in group)
    e_max = max(s[5] for s 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)
            
            
            
        