結果
問題 | No.90 品物の並び替え |
ユーザー |
|
提出日時 | 2024-11-07 20:19:48 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 418 ms / 5,000 ms |
コード長 | 359 bytes |
コンパイル時間 | 363 ms |
コンパイル使用メモリ | 82,036 KB |
実行使用メモリ | 75,776 KB |
最終ジャッジ日時 | 2024-11-07 20:19:50 |
合計ジャッジ時間 | 1,914 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 9 |
ソースコード
from itertools import permutationsN,M = map(int,input().split())A = [list(map(int,input().split())) for _ in range(M)]ans = 0for P in permutations(range(N)):Ind = [0]*Nfor i in range(N):Ind[P[i]] = icnt = 0for j in range(M):a,b,c = A[j]if Ind[a]<Ind[b]:cnt += cans = max(ans,cnt)print(ans)