結果
| 問題 |
No.90 品物の並び替え
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-10-23 01:09:12 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 643 ms / 5,000 ms |
| コード長 | 452 bytes |
| コンパイル時間 | 391 ms |
| コンパイル使用メモリ | 82,424 KB |
| 実行使用メモリ | 76,032 KB |
| 最終ジャッジ日時 | 2024-07-21 09:42:12 |
| 合計ジャッジ時間 | 2,373 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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)