結果
| 問題 | No.90 品物の並び替え |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-10-23 01:09:12 |
| 言語 | PyPy3 (7.3.23) |
| 結果 |
AC
|
| 実行時間 | 482 ms / 5,000 ms |
| + 957µs | |
| コード長 | 452 bytes |
| 記録 | |
| コンパイル時間 | 256 ms |
| コンパイル使用メモリ | 96,100 KB |
| 実行使用メモリ | 84,168 KB |
| 最終ジャッジ日時 | 2026-08-21 13:16:56 |
| 合計ジャッジ時間 | 2,696 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 9 |
ソースコード
from itertools import permutations
N,M = map(int,input().split())
l = [[] for _ in range(N)]
ans = 0
for _ in range(M):
i1,i2,s = map(int,input().split())
l[i1].append([i2,s])
for perm in permutations(range(N)):
perm = list(perm)
now = 0
checkList = []
for i in perm:
checkList.append(i)
for item,score in l[i]:
if item not in checkList:
now += score
ans = max(ans,now)
print(ans)