結果
問題 |
No.90 品物の並び替え
|
ユーザー |
|
提出日時 | 2024-08-12 23:52:08 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 563 bytes |
コンパイル時間 | 392 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 74,908 KB |
最終ジャッジ日時 | 2024-08-12 23:52:21 |
合計ジャッジ時間 | 12,757 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 8 TLE * 1 |
ソースコード
import itertools N, M = map(int, input().split()) all_pattern = list(itertools.permutations(range(N))) # 順列 result = [0] * len(all_pattern) for _ in range(M): item1, item2, score = map(int, input().split()) for i, pattern in enumerate(all_pattern): sts = False for item in pattern: if item == item2 and not sts: break elif item == item1 and not sts: sts = True elif item == item2 and sts: result[i] += score break print(max(result))