結果
問題 |
No.90 品物の並び替え
|
ユーザー |
|
提出日時 | 2017-01-02 11:14:42 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 603 bytes |
コンパイル時間 | 251 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 21,376 KB |
最終ジャッジ日時 | 2024-12-16 03:07:28 |
合計ジャッジ時間 | 26,338 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 5 TLE * 4 |
ソースコード
# coding: utf-8 # yukicoder No.90 品物の並び替え from itertools import permutations from itertools import combinations def p_score(p, rule): score = 0 for i in combinations(p, 2): for c in rule: if list(i) == c[:2]: score += c[2] break return score N, M = map(int, input().split()) rule = [[int(i) for i in input().split()] for _ in range(M)] max_score = -1 # 総当たり for p in permutations(range(N)): score = p_score(p, rule) if score > max_score: max_score = score print(max_score)