結果

問題 No.90 品物の並び替え
ユーザー pluto77pluto77
提出日時 2016-08-12 11:31:44
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 245 ms / 5,000 ms
コード長 353 bytes
コンパイル時間 1,718 ms
コンパイル使用メモリ 76,672 KB
実行使用メモリ 78,208 KB
最終ジャッジ日時 2024-04-25 02:29:54
合計ジャッジ時間 3,468 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
75,520 KB
testcase_01 AC 115 ms
77,440 KB
testcase_02 AC 85 ms
75,648 KB
testcase_03 AC 97 ms
77,824 KB
testcase_04 AC 97 ms
78,208 KB
testcase_05 AC 107 ms
77,696 KB
testcase_06 AC 106 ms
77,952 KB
testcase_07 AC 96 ms
77,568 KB
testcase_08 AC 85 ms
75,520 KB
testcase_09 AC 245 ms
77,824 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#coding: utf-8
#yuki_90
from itertools import permutations

n,m=map(int,raw_input().split())
l=[[0 for i in xrange(n)] for j in xrange(n)]

for i in xrange(m):
 a,b,s=map(int,raw_input().split())
 l[a][b]=s
 

maxa=0
for p in permutations(range(n)):
 t=0
 for i in xrange(n):
  for j in xrange(i+1,n):
   t+=l[p[i]][p[j]]
 maxa=max(t,maxa)
 
print maxa
0