結果
| 問題 |
No.90 品物の並び替え
|
| コンテスト | |
| ユーザー |
masumasumath1
|
| 提出日時 | 2019-11-30 12:11:44 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 525 bytes |
| コンパイル時間 | 248 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 17,576 KB |
| 最終ジャッジ日時 | 2024-11-21 01:09:05 |
| 合計ジャッジ時間 | 10,999 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | WA * 8 TLE * 1 |
ソースコード
import sys
import itertools
N, M = map(int,input().split())
listN = [i for i in range(N)]
scores = [[] for _ in range(M)]
for i in range(M):
a,b,sc = map(int,input().split())
scores[i] = [a,b,sc]
scores.sort()
ans = 0
for t in itertools.permutations(listN):
score = 0
for i in range(N-1):
for s in scores:
if t[i] == s[0] and t[i+1] == s[1]:
score += s[2]
break
elif s[0] > t[i]:
break
ans = max(ans,score)
print(ans)
masumasumath1