結果

問題 No.586 ダブルブッキング
ユーザー toshiro_yanagitoshiro_yanagi
提出日時 2018-06-06 20:30:19
言語 Nim
(2.0.2)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 379 bytes
コンパイル時間 5,057 ms
コンパイル使用メモリ 68,232 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-12 22:50:44
合計ジャッジ時間 5,354 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 RE -
testcase_02 AC 1 ms
4,380 KB
testcase_03 RE -
testcase_04 AC 2 ms
4,380 KB
testcase_05 RE -
testcase_06 AC 1 ms
4,380 KB
testcase_07 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 18) Warning: imported and not used: 'sequtils' [UnusedImport]

ソースコード

diff #

import strutils, sequtils, tables
proc getInt: int = stdin.readLine.parseInt

# Yuki/振替先ホテルの料金, 予約の件数
let P1, P2, N = getInt()

var
  R = initCountTable[int]()   #予約された部屋番号
  cost = 0

for n in 0 ..< N: R.inc getInt()

while R.largest.val > 1:
  let maxR = R.largest
  cost += (P1 + P2) * (maxR.val - 1)
  R[maxR.key] = 0

echo cost
0