結果

問題 No.1015 おつりは要らないです
ユーザー nadeshinonadeshino
提出日時 2020-04-03 21:43:35
言語 Nim
(2.0.2)
結果
WA  
実行時間 -
コード長 1,103 bytes
コンパイル時間 4,502 ms
コンパイル使用メモリ 69,636 KB
実行使用メモリ 12,092 KB
最終ジャッジ日時 2023-09-16 00:48:46
合計ジャッジ時間 7,909 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

import algorithm, math, strutils, sequtils, tables, macros

let read* = iterator: string {.closure.} =
  while true: (for s in stdin.readLine.split: yield s)

template input*(T: static[typedesc]): untyped = 
  when T is int: read().parseInt
  elif T is float: read().parseFloat
  elif T is string: read()

macro dump*(arg: varargs[untyped]): untyped =
  result = newNimNode(nnkStmtList)
  for x in arg:
    let name = toStrLit(x)
    result.add(quote do: stderr.write `name`, " = " , `x`, ", ")
  result.add(quote do: stderr.write "\n")

var N, X, Y, Z = input(int)
var A = @[-1 * 10 ^ 18] & newSeqWith(N, input(int)) & @[10 ^ 18]

for i in 1 .. N:
  if A[i] >= 10000:
    let K = min(A[i] div 10000, Z)
    A[i] -= K * 10000
    Z -= K

for i in 1 .. N:
  if A[i] >= 5000:
    let K = min(A[i] div 5000, Y)
    A[i] -= K * 5000
    Y -= K

A.sort(cmp, Descending)

for i in 1 .. Z:
  A[i] -= 10000

A.sort(cmp, Descending)

for i in 1 .. Y:
  A[i] -= 5000

for i in 1 .. N:
  while A[i] >= 0 and X > 0:
    A[i] -= 1000
    dec X

if A[1 .. N].filterIt(it >= 0).len == 0:
  echo "Yes"
else:
  echo "No"
0