結果
| 問題 |
No.90 品物の並び替え
|
| コンテスト | |
| ユーザー |
maatanbeta
|
| 提出日時 | 2017-04-27 15:05:05 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 658 bytes |
| コンパイル時間 | 222 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 64,512 KB |
| 最終ジャッジ日時 | 2024-09-13 14:48:36 |
| 合計ジャッジ時間 | 8,500 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | WA * 8 TLE * 1 |
ソースコード
import itertools
N, M = map(int, input().split())
item1 = [0] * M
item2 = [0] * M
score = [0] * M
max_score = 0
# sheat = []
"""
for p in range(N):
l = []
for q in range(N):
l.append(0)
sheat.append(l)
"""
for i in range(M):
item1[i], item2[i], score[i] = map(int, input().split())
# sheat[item1[i]][item2[i]] = score[i]
perm = [i for i in range(N)]
p = list(itertools.permutations(perm))
for ichi in p:
temp = 0
for i in range(M):
if ichi[item1[i]-1] < ichi[item2[i]-1]:
temp += score[i]
if temp > max_score:
max_score = temp
max_retu = ichi
print(max_score)
print(max_retu)
maatanbeta