結果
問題 |
No.1792 科学の甲子園
|
ユーザー |
![]() |
提出日時 | 2025-03-31 17:26:15 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 919 bytes |
コンパイル時間 | 166 ms |
コンパイル使用メモリ | 82,252 KB |
実行使用メモリ | 79,280 KB |
最終ジャッジ日時 | 2025-03-31 17:27:50 |
合計ジャッジ時間 | 4,423 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 WA * 3 |
ソースコード
n = int(input()) students = [] for _ in range(n): parts = list(map(int, input().split())) students.append(parts) subjects = [0, 1, 2, 3, 4, 5] # M, I, P, C, B, E K = 5 candidates = set() for s in subjects: sorted_indices = sorted(range(n), key=lambda i: (-students[i][s], i)) top_k = sorted_indices[:K] for idx in top_k: candidates.add(idx) candidates = list(candidates) max_product = 0 from itertools import combinations for combo in combinations(candidates, 4): max_m = max(students[i][0] for i in combo) max_i = max(students[i][1] for i in combo) max_p = max(students[i][2] for i in combo) max_c = max(students[i][3] for i in combo) max_b = max(students[i][4] for i in combo) max_e = max(students[i][5] for i in combo) product = max_m * max_i * max_p * max_c * max_b * max_e if product > max_product: max_product = product print(max_product)