結果
| 問題 |
No.90 品物の並び替え
|
| コンテスト | |
| ユーザー |
バカらっく
|
| 提出日時 | 2019-09-28 04:24:22 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 902 bytes |
| コンパイル時間 | 93 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-09-25 10:07:00 |
| 合計ジャッジ時間 | 7,655 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 8 TLE * 1 |
ソースコード
# -*- coding:utf-8 -*-
(n, m) = [int(i) for i in input().rstrip().split(" ")]
map = {}
for i in range(m):
(item1, item2, score) = [int(i) for i in input().rstrip().split(" ")]
if item1 not in map.keys():
map[item1] = {}
map[item1][item2] = score
def get_ans(*items):
if len(items) >= n:
return calc(items)
total_score = 0
for i in range(0, n):
if i in items:
continue
ret = get_ans(*items, i)
total_score = max(ret, total_score)
return total_score
def calc(items):
total = 0
for i in range(len(items) - 1):
if items[i] not in map.keys():
continue
for j in range(i + 1, len(items)):
if items[j] not in map[items[i]].keys():
continue
total += map[items[i]][items[j]]
return total
ans = max([get_ans(i) for i in range(0, n)])
print(ans)
バカらっく