結果

問題 No.90 品物の並び替え
ユーザー maspymaspy
提出日時 2020-01-29 22:46:31
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 760 ms / 5,000 ms
コード長 425 bytes
コンパイル時間 231 ms
コンパイル使用メモリ 10,784 KB
実行使用メモリ 100,580 KB
最終ジャッジ日時 2023-10-14 07:47:10
合計ジャッジ時間 3,534 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 140 ms
29,796 KB
testcase_01 AC 189 ms
37,852 KB
testcase_02 AC 136 ms
29,664 KB
testcase_03 AC 142 ms
30,568 KB
testcase_04 AC 140 ms
30,564 KB
testcase_05 AC 186 ms
37,892 KB
testcase_06 AC 183 ms
37,748 KB
testcase_07 AC 135 ms
29,812 KB
testcase_08 AC 136 ms
29,700 KB
testcase_09 AC 760 ms
100,580 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np
import itertools

N,M = map(int,readline().split())
m = map(int,read().split())
ABC = zip(m,m,m)

perms = np.array(list(itertools.permutations(range(N))))

score = np.zeros(len(perms), np.int64)

for a,b,c in ABC:
    score[perms[:,a] < perms[:,b]] += c

answer = score.max()
print(answer)
0