結果
問題 |
No.1792 科学の甲子園
|
ユーザー |
![]() |
提出日時 | 2025-03-20 18:57:27 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,421 bytes |
コンパイル時間 | 238 ms |
コンパイル使用メモリ | 82,452 KB |
実行使用メモリ | 84,864 KB |
最終ジャッジ日時 | 2025-03-20 18:58:37 |
合計ジャッジ時間 | 7,142 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 8 TLE * 1 -- * 17 |
ソースコード
import itertools def main(): 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 = 20 candidates = set() # For each subject (0 to 5), collect top k students' indices for subject in range(6): # Create list of tuples (-score for descending order, index) subject_scores = [ (-students[i][subject], i) for i in range(n) ] # Sort by score ascending (which is descending when score is negated) subject_scores.sort() # Take top k entries for i in range(min(k, n)): idx = subject_scores[i][1] candidates.add(idx) candidates = list(candidates) if len(candidates) < 4: print(0) return max_product = 0 # Iterate over all combinations of 4 students from candidates for group in itertools.combinations(candidates, 4): m = max(students[i][0] for i in group) info = max(students[i][1] for i in group) p = max(students[i][2] for i in group) c = max(students[i][3] for i in group) b = max(students[i][4] for i in group) e = max(students[i][5] for i in group) product = m * info * p * c * b * e if product > max_product: max_product = product print(max_product) if __name__ == "__main__": main()