結果
問題 | No.90 品物の並び替え |
ユーザー |
|
提出日時 | 2018-08-14 11:19:06 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 1,734 ms / 5,000 ms |
コード長 | 615 bytes |
コンパイル時間 | 233 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-09-24 08:40:34 |
合計ジャッジ時間 | 3,372 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 9 |
ソースコード
from itertools import permutationsfrom sys import stdin, stdoutinput = lambda: stdin.readline()write = stdout.writedef main():N, M = map(int, input().split())I = [tuple(map(int, input().split())) for _ in range(M)]table = [[0] * N for _ in [0] * N]for i1, i2, s in I:table[i1][i2] = sdef calc(n):ret = 0for i in range(N - 1):for j in range(i + 1, N):ret += table[n[i]][n[j]]return retscore = 0for n in permutations(range(N)):ret = calc(n)score = max(score, ret)print(score)main()