結果

問題 No.818 Dinner time
ユーザー ikdikd
提出日時 2019-04-19 22:04:36
言語 Nim
(2.0.2)
結果
WA  
実行時間 -
コード長 511 bytes
コンパイル時間 3,133 ms
コンパイル使用メモリ 71,648 KB
実行使用メモリ 18,804 KB
最終ジャッジ日時 2023-09-14 16:05:51
合計ジャッジ時間 6,383 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 WA -
testcase_05 AC 2 ms
4,380 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 2 ms
4,376 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 28) Warning: imported and not used: 'math' [UnusedImport]

ソースコード

diff #

import strutils, sequtils, math

proc main() =
  var
    nm = stdin.readLine.split.map(parseInt)
    (n, m) = (nm[0], nm[1])
    abi = (0..<n).mapIt(stdin.readLine.split.map(parseBiggestInt))
  
  var
    aacc = newSeq[int64]()
    bestAcc = newSeq[int64]()
  aacc.add(0)
  bestAcc.add(0)
  for ab in abi:
    aacc.add(aacc[^1] + ab[0])
    bestAcc.add(bestAcc[^1] + max(ab[0], ab[1]))
  var ans:int64 = 0
  if bestAcc.max > aacc.max:
    ans += bestAcc.max
    m -= 1
  ans += aacc.max * m
  echo ans
  
main()
0