結果
問題 | No.90 品物の並び替え |
ユーザー | nanae |
提出日時 | 2017-01-02 11:14:42 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 603 bytes |
コンパイル時間 | 238 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 17,568 KB |
最終ジャッジ日時 | 2024-05-09 13:27:58 |
合計ジャッジ時間 | 6,813 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 32 ms
10,752 KB |
testcase_01 | TLE | - |
testcase_02 | -- | - |
testcase_03 | -- | - |
testcase_04 | -- | - |
testcase_05 | -- | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
ソースコード
# 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)