結果
| 問題 |
No.1792 科学の甲子園
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-04-15 23:36:11 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,221 bytes |
| コンパイル時間 | 322 ms |
| コンパイル使用メモリ | 82,288 KB |
| 実行使用メモリ | 77,320 KB |
| 最終ジャッジ日時 | 2025-04-15 23:37:00 |
| 合計ジャッジ時間 | 2,973 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 WA * 4 |
ソースコード
import itertools
def main():
import sys
input = sys.stdin.read().split()
idx = 0
N = int(input[idx])
idx += 1
students = []
for _ in range(N):
M = int(input[idx])
I = int(input[idx+1])
P = int(input[idx+2])
C = int(input[idx+3])
B = int(input[idx+4])
E = int(input[idx+5])
students.append((M, I, P, C, B, E))
idx += 6
candidates = set()
for subject in range(6):
sorted_indices = sorted(range(N), key=lambda i: students[i][subject], reverse=True)
for i in range(min(4, len(sorted_indices))):
candidates.add(sorted_indices[i])
candidate_list = list(candidates)
max_product = 0
for team in itertools.combinations(candidate_list, 4):
m = max(students[i][0] for i in team)
i = max(students[i][1] for i in team)
p = max(students[i][2] for i in team)
c = max(students[i][3] for i in team)
b = max(students[i][4] for i in team)
e = max(students[i][5] for i in team)
product = m * i * p * c * b * e
if product > max_product:
max_product = product
print(max_product)
if __name__ == '__main__':
main()
lam6er