結果
| 問題 |
No.90 品物の並び替え
|
| コンテスト | |
| ユーザー |
kou_kkk
|
| 提出日時 | 2024-04-24 10:09:11 |
| 言語 | Nim (2.2.0) |
| 結果 |
AC
|
| 実行時間 | 670 ms / 5,000 ms |
| コード長 | 556 bytes |
| コンパイル時間 | 3,990 ms |
| コンパイル使用メモリ | 66,688 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-06 17:42:11 |
| 合計ジャッジ時間 | 5,697 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 9 |
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 19) Warning: imported and not used: 'math' [UnusedImport]
ソースコード
import algorithm, math, sequtils, strutils
let
nm = stdin.readLine.split.map parseInt
n = nm[0]
m = nm[1]
inputs = (0 ..< m).mapIt stdin.readLine.split.map parseInt
var
g = n.succ.newSeqWith newSeq[(int, int)](succ n)
for v in inputs:
g[v[0]].add (v[1], v[2])
proc fn(xs: seq[int]): int =
result = 0
var
points = 0.repeat n.succ
for x in xs:
result += points[x]
for (b, p) in g[x]:
points[b] += p
var
xs = (0 ..< n).toSeq
maximum = fn xs
while nextPermutation xs:
maximum = xs.fn.max maximum
echo maximum
kou_kkk