結果
| 問題 | No.90 品物の並び替え |
| コンテスト | |
| ユーザー |
6soukiti29
|
| 提出日時 | 2017-08-16 16:55:37 |
| 言語 | Nim (2.2.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 699 bytes |
| 記録 | |
| コンパイル時間 | 814 ms |
| コンパイル使用メモリ | 64,384 KB |
| 最終ジャッジ日時 | 2024-06-30 02:45:15 |
| 合計ジャッジ時間 | 1,171 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
/home/judge/data/code/Main.nim(8, 29) Error: type mismatch: got 'seq[int]' for 'map(split(readLine(stdin), {' ', '\t', '\v', '\r', '\n', '\f'}, -1), parseInt)' but expected 'tuple'
ソースコード
import sequtils,strutils,algorithm,math
type
item = tuple[a, b, score : int]
var
N,M,a,b,c : int
p : item
(N,M) = stdin.readline.split.map(parseInt)
var
Items = newSeq[item](0)
nodes = newSeq[int](N)
ans : int
for n in 0..<N:
nodes[n] = n
for m in 1..M:
(a,b,c) = stdin.readline.split.map(parseInt)
Items.add((a,b,c))
proc index[T](A : openarray[T], a:T) : int =
for i in 0..A.high:
if A[i] == a:
return i
return -1
proc sum_score(): int =
for t in Items:
if nodes.index(t.a) < nodes.index(t.b):
result += t.score
ans = sum_score()
while nodes.nextPermutation:
ans = max(sum_score(), ans)
echo ans
6soukiti29