結果
問題 | No.90 品物の並び替え |
ユーザー |
|
提出日時 | 2020-12-07 18:55:41 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 763 ms / 5,000 ms |
コード長 | 580 bytes |
コンパイル時間 | 189 ms |
コンパイル使用メモリ | 82,300 KB |
実行使用メモリ | 98,796 KB |
最終ジャッジ日時 | 2024-09-17 14:00:56 |
合計ジャッジ時間 | 2,203 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 9 |
ソースコード
import itertools N, M = map(int, input().split()) score_table = [] for i in range(M): score_table.append(list(map(int, input().split()))) perms = itertools.permutations(list(range(N))) total_score_list = [] for perm in perms: total_score = 0 for [back, forth, score] in score_table: for elem in perm: if elem == forth: break elif elem == back: total_score += score break else: continue total_score_list.append(total_score) print(max(total_score_list))