結果

問題 No.2922 Rose Garden
ユーザー kemunikukemuniku
提出日時 2024-10-12 14:47:05
言語 Nim
(2.0.2)
結果
WA  
実行時間 -
コード長 6,118 bytes
コンパイル時間 4,628 ms
コンパイル使用メモリ 76,048 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-12 14:47:21
合計ジャッジ時間 12,378 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 200 ms
5,248 KB
testcase_16 AC 161 ms
5,248 KB
testcase_17 AC 335 ms
5,248 KB
testcase_18 AC 19 ms
5,248 KB
testcase_19 AC 167 ms
5,248 KB
testcase_20 AC 210 ms
5,248 KB
testcase_21 AC 325 ms
5,248 KB
testcase_22 AC 132 ms
5,248 KB
testcase_23 AC 256 ms
5,248 KB
testcase_24 AC 30 ms
5,248 KB
testcase_25 AC 139 ms
5,248 KB
testcase_26 AC 207 ms
5,248 KB
testcase_27 AC 250 ms
5,248 KB
testcase_28 AC 173 ms
5,248 KB
testcase_29 AC 175 ms
5,248 KB
testcase_30 AC 6 ms
5,248 KB
testcase_31 AC 2 ms
5,248 KB
testcase_32 AC 4 ms
5,248 KB
testcase_33 AC 2 ms
5,248 KB
testcase_34 AC 8 ms
5,248 KB
testcase_35 AC 3 ms
5,248 KB
testcase_36 AC 12 ms
5,248 KB
testcase_37 AC 11 ms
5,248 KB
testcase_38 AC 6 ms
5,248 KB
testcase_39 AC 8 ms
5,248 KB
testcase_40 AC 204 ms
5,248 KB
testcase_41 AC 30 ms
5,248 KB
testcase_42 AC 299 ms
5,248 KB
testcase_43 AC 99 ms
5,248 KB
testcase_44 AC 326 ms
5,248 KB
testcase_45 AC 58 ms
5,248 KB
testcase_46 AC 101 ms
5,248 KB
testcase_47 AC 87 ms
5,248 KB
testcase_48 AC 17 ms
5,248 KB
testcase_49 AC 99 ms
5,248 KB
testcase_50 AC 1 ms
5,248 KB
testcase_51 AC 1 ms
5,248 KB
testcase_52 AC 2 ms
5,248 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import macros;macro ImportExpand(s:untyped):untyped = parseStmt($s[2])
ImportExpand "cplib/tmpl/sheep.nim" <=== "when not declared CPLIB_TMPL_SHEEP:\n    const CPLIB_TMPL_SHEEP* = 1\n    {.warning[UnusedImport]: off.}\n    {.hint[XDeclaredButNotUsed]: off.}\n    import algorithm\n    import sequtils\n    import tables\n    import macros\n    import math\n    import sets\n    import strutils\n    import strformat\n    import sugar\n    import heapqueue\n    import streams\n    import deques\n    import bitops\n    import std/lenientops\n    import options\n    #入力系\n    proc scanf(formatstr: cstring){.header: \"<stdio.h>\", varargs.}\n    proc getchar(): char {.importc: \"getchar_unlocked\", header: \"<stdio.h>\", discardable.}\n    proc ii(): int {.inline.} = scanf(\"%lld\\n\", addr result)\n    proc lii(N: int): seq[int] {.inline.} = newSeqWith(N, ii())\n    proc si(): string {.inline.} =\n        result = \"\"\n        var c: char\n        while true:\n            c = getchar()\n            if c == ' ' or c == '\\n':\n                break\n            result &= c\n    #chmin,chmax\n    template `max=`(x, y) = x = max(x, y)\n    template `min=`(x, y) = x = min(x, y)\n    #bit演算\n    proc `%`*(x: int, y: int): int =\n        result = x mod y\n        if y > 0 and result < 0: result += y\n        if y < 0 and result > 0: result += y\n    proc `//`*(x: int, y: int): int{.inline.} =\n        result = x div y\n        if y > 0 and result * y > x: result -= 1\n        if y < 0 and result * y < x: result -= 1\n    proc `%=`(x: var int, y: int): void = x = x%y\n    proc `//=`(x: var int, y: int): void = x = x//y\n    proc `**`(x: int, y: int): int = x^y\n    proc `**=`(x: var int, y: int): void = x = x^y\n    proc `^`(x: int, y: int): int = x xor y\n    proc `|`(x: int, y: int): int = x or y\n    proc `&`(x: int, y: int): int = x and y\n    proc `>>`(x: int, y: int): int = x shr y\n    proc `<<`(x: int, y: int): int = x shl y\n    proc `~`(x: int): int = not x\n    proc `^=`(x: var int, y: int): void = x = x ^ y\n    proc `&=`(x: var int, y: int): void = x = x & y\n    proc `|=`(x: var int, y: int): void = x = x | y\n    proc `>>=`(x: var int, y: int): void = x = x >> y\n    proc `<<=`(x: var int, y: int): void = x = x << y\n    proc `[]`(x: int, n: int): bool = (x and (1 shl n)) != 0\n    #便利な変換\n    proc `!`(x: char, a = '0'): int = int(x)-int(a)\n    #定数\n    #[ include cplib/utils/constants ]#\n    when not declared CPLIB_UTILS_CONSTANTS:\n        const CPLIB_UTILS_CONSTANTS* = 1\n        const INF32*: int32 = 100100111.int32\n        const INF64*: int = int(3300300300300300491)\n    const INF = INF64\n    #converter\n\n    #range\n    iterator range(start: int, ends: int, step: int): int =\n        var i = start\n        if step < 0:\n            while i > ends:\n                yield i\n                i += step\n        elif step > 0:\n            while i < ends:\n                yield i\n                i += step\n    iterator range(ends: int): int = (for i in 0..<ends: yield i)\n    iterator range(start: int, ends: int): int = (for i in\n            start..<ends: yield i)\n\n    #joinが非stringでめちゃくちゃ遅いやつのパッチ\n    proc join*[T: not string](a: openArray[T], sep: string = \"\"): string = a.mapit($it).join(sep)\n"
ImportExpand "cplib/collections/defaultdict.nim" <=== "when not declared CPLIB_COLLECTIONS_DEFAULTDICT:\n    const CPLIB_COLLECTIONS_DEFAULTDICT* = 1\n    import tables\n    import hashes\n    type DefaultDict*[K, V] = object\n        table: Table[K, V]\n        default: V\n    proc initDefaultDict*[K, V](default: V): DefaultDict[K, V] = DefaultDict[K, V](table: initTable[K, V](), default: default)\n    proc `==`*[K, V](src, dst: DefaultDict[K, V]): bool = src.table == dst.table\n    proc `[]=`*[K, V](d: var DefaultDict[K, V], key: K, val: V) = d.table[key] = val\n    proc `[]`*[K, V](d: DefaultDict[K, V], key: K): V =\n        if key notin d.table: return d.default()\n        return d.table[key]\n    proc `[]`*[K, V](d: var DefaultDict[K, V], key: K): var V =\n        if key notin d.table: d.table[key] = d.default\n        return d.table[key]\n    proc clear*[K, V](d: var DefaultDict[K, V]) = d.table = initTable[K, V](0)\n    proc contains*[K, V](d: var DefaultDict[K, V], key: K): bool = d.table.contains(key)\n    proc del*[K, V](d: var DefaultDict[K, V], key: K) = d.table.del(key)\n    proc hash*[K, V](d: DefaultDict[K, V]): Hash = d.table.hash\n    proc hasKey*[K, V](d: DefaultDict[K, V], key: K): bool = d.table.hasKey(key)\n    proc len*[K, V](d: DefaultDict[K, V]): int = d.table.len\n    proc pop*[K, V](d: var DefaultDict, key: K, val: var V): bool = d.table.pop(key, val)\n    proc take*[K, V](d: var DefaultDict, key: K, val: var V): bool = d.table.pop(key, val)\n    proc toDefaultDict*[K, V](pairs: openArray[(K, V)], default: V): DefaultDict[K, V] =\n        result = initDefaultDict[K, V](default)\n        result.table = pairs.toTable\n    proc toDefaultDict*[K, V](table: Table[K, V], default: V): DefaultDict[K, V] =\n        result = initDefaultDict[K, V](default)\n        result.table = table\n    iterator pairs*[K, V](d: DefaultDict[K, V]): (K, V) =\n        for k, v in d.table: yield (k, v)\n    iterator mpairs*[K, V](d: var DefaultDict[K, V]): (K, var V) =\n        for k, v in d.table.mpairs: yield (k, v)\n    iterator keys*[K, V](d: DefaultDict[K, V]): K =\n        for k in d.table.keys: yield k\n    iterator values*[K, V](d: DefaultDict[K, V]): V =\n        for v in d.table.values: yield v\n    proc `$`*[K, V](d: DefaultDict[K, V]): string = $(d.table)\n"
{.checks:off.}
var N,S,B = ii()
var H = lii(N)

var now = initDefaultDict[int,int](-INF)

for i in range(N-1):
    var next = initDefaultDict[int,int](-INF)
    now[S].max = H[i]
    for s in now.keys():
        if now[s] >= H[i+1]:
            next[s].max = now[s]
        else:
            var need = (H[i+1]-now[s]+(B-1))//B
            if need <= s:
                next[s-need].max = now[s]+need*B
    now = move(next)

if len(now) != 0:
    echo "Yes"
else:
    echo "No"

0