結果

問題 No.90 品物の並び替え
ユーザー phtmscgphtmscg
提出日時 2019-03-29 19:24:19
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 3,651 ms / 5,000 ms
コード長 518 bytes
コンパイル時間 104 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 25,088 KB
最終ジャッジ日時 2024-04-24 16:43:06
合計ジャッジ時間 5,530 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
10,752 KB
testcase_01 AC 333 ms
12,416 KB
testcase_02 AC 27 ms
10,624 KB
testcase_03 AC 54 ms
10,752 KB
testcase_04 AC 60 ms
10,752 KB
testcase_05 AC 352 ms
12,288 KB
testcase_06 AC 293 ms
12,288 KB
testcase_07 AC 30 ms
10,752 KB
testcase_08 AC 27 ms
10,752 KB
testcase_09 AC 3,651 ms
25,088 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M = map(int,input().split())
items = [list(map(int,input().split())) for _ in range(M)]
ss = []

def change(n,*args):
    b = list(args)
    c = list(args)
    if n < N:
        for i in range(N):
            if b[n] == -1 and i not in b:
                c[n] = i
                change(n+1,*c)
    else:
        score = 0
        for j in range(M):
            if b[items[j][0]] < b[items[j][1]]:
                score += items[j][2]
        global ss
        ss.append(score)
a = [-1]*N
change(0,*a)
print(max(ss))
0