結果

問題 No.2278 Time Bomb Game 2
ユーザー DaylightDaylight
提出日時 2023-04-21 22:10:31
言語 Nim
(2.0.2)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 3,314 bytes
コンパイル時間 5,098 ms
コンパイル使用メモリ 75,708 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-06 17:03:54
合計ジャッジ時間 6,794 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 2 ms
6,820 KB
testcase_02 AC 1 ms
6,820 KB
testcase_03 AC 2 ms
6,816 KB
testcase_04 AC 2 ms
6,820 KB
testcase_05 AC 1 ms
6,820 KB
testcase_06 AC 2 ms
6,820 KB
testcase_07 AC 3 ms
6,816 KB
testcase_08 AC 2 ms
6,816 KB
testcase_09 AC 3 ms
6,820 KB
testcase_10 AC 4 ms
6,816 KB
testcase_11 AC 4 ms
6,816 KB
testcase_12 AC 5 ms
6,820 KB
testcase_13 AC 4 ms
6,816 KB
testcase_14 AC 4 ms
6,820 KB
testcase_15 AC 4 ms
6,820 KB
testcase_16 AC 4 ms
6,816 KB
testcase_17 AC 4 ms
6,820 KB
testcase_18 AC 4 ms
6,816 KB
testcase_19 AC 4 ms
6,820 KB
testcase_20 AC 4 ms
6,816 KB
testcase_21 AC 4 ms
6,820 KB
testcase_22 AC 4 ms
6,816 KB
testcase_23 AC 4 ms
6,820 KB
testcase_24 AC 4 ms
6,820 KB
testcase_25 AC 3 ms
6,820 KB
testcase_26 AC 4 ms
6,820 KB
testcase_27 AC 4 ms
6,820 KB
testcase_28 AC 4 ms
6,816 KB
testcase_29 AC 4 ms
6,816 KB
testcase_30 AC 3 ms
6,820 KB
testcase_31 AC 4 ms
6,816 KB
testcase_32 AC 4 ms
6,816 KB
testcase_33 AC 4 ms
6,816 KB
testcase_34 AC 3 ms
6,816 KB
testcase_35 AC 3 ms
6,820 KB
testcase_36 AC 4 ms
6,816 KB
testcase_37 AC 4 ms
6,820 KB
testcase_38 AC 4 ms
6,816 KB
testcase_39 AC 3 ms
6,816 KB
testcase_40 AC 4 ms
6,820 KB
testcase_41 AC 4 ms
6,816 KB
testcase_42 AC 5 ms
6,816 KB
testcase_43 AC 4 ms
6,820 KB
testcase_44 AC 4 ms
6,820 KB
testcase_45 AC 4 ms
6,816 KB
testcase_46 AC 4 ms
6,816 KB
testcase_47 AC 4 ms
6,816 KB
testcase_48 AC 4 ms
6,820 KB
testcase_49 AC 3 ms
6,816 KB
testcase_50 AC 4 ms
6,816 KB
testcase_51 AC 4 ms
6,816 KB
testcase_52 AC 4 ms
6,816 KB
testcase_53 AC 4 ms
6,816 KB
testcase_54 AC 4 ms
6,816 KB
testcase_55 AC 4 ms
6,816 KB
testcase_56 AC 4 ms
6,820 KB
testcase_57 AC 4 ms
6,816 KB
testcase_58 AC 4 ms
6,820 KB
testcase_59 AC 4 ms
6,816 KB
testcase_60 AC 4 ms
6,820 KB
testcase_61 AC 4 ms
6,816 KB
testcase_62 AC 4 ms
6,820 KB
testcase_63 AC 3 ms
6,816 KB
testcase_64 AC 4 ms
6,820 KB
testcase_65 AC 4 ms
6,816 KB
testcase_66 AC 5 ms
6,816 KB
testcase_67 AC 4 ms
6,820 KB
testcase_68 AC 4 ms
6,820 KB
testcase_69 AC 4 ms
6,820 KB
testcase_70 AC 4 ms
6,816 KB
testcase_71 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(25, 12) Warning: imported and not used: 'sugar' [UnusedImport]
/home/judge/data/code/Main.nim(23, 15) Warning: imported and not used: 'math' [UnusedImport]
/home/judge/data/code/Main.nim(15, 12) Warning: imported and not used: 'algorithm' [UnusedImport]
/home/judge/data/code/Main.nim(18, 12) Warning: imported and not used: 'lists' [UnusedImport]
/home/judge/data/code/Main.nim(21, 12) Warning: imported and not used: 'sequtils' [UnusedImport]

ソースコード

diff #

import macros
macro Please(x): untyped = nnkStmtList.newTree()

Please use Nim-ACL
Please use Nim-ACL
Please use Nim-ACL



#[ include daylight/base ]#
when not declared DAYLIGHT_BASE_HPP:
    const DAYLIGHT_BASE_HPP* = 1
    import system
    import macros
    import algorithm
    import tables
    import sets
    import lists
    import intsets
    import critbits
    import sequtils
    import strutils
    import std/math
    import strformat
    import sugar
    let readToken* = iterator(oneChar: bool = false): string {.closure.}= 
        while true:
            var line = stdin.readLine.split
            for s in line:
                if oneChar:
                    for i in 0..<s.len():
                        yield s[i..i]
                else:
                    yield s
    proc read*(t: typedesc[string]): string = 
        result = readToken()
        while result == "":
            result = readToken()
    proc read*(t: typedesc[int]): int = read(string).parseInt
    proc read*(t: typedesc[float]): float = read(string).parseFloat
    proc read*(t: typedesc[char]): char = readToken(true)[0]

    macro readSeq*(t: typedesc, n: varargs[int]): untyped =
        var repStr = ""
        for arg in n:
            repStr &= &"({arg.repr}).newSeqWith "
        parseExpr(&"{repStr}read({t})")
    
    macro read*(ts: varargs[auto]): untyped=
        var tupStr = ""
        for t in ts:
            tupStr &= &"read({t.repr}),"
        parseExpr(&"({tupStr})")
        
    macro readTupleSeq*(n: int, ts:varargs[auto]): untyped=
        for typ in ts:
            if typ.typeKind != ntyAnything:
                error("Expected typedesc, got " & typ.repr, typ)
        parseExpr(&"({n.repr}).newSeqWith read({ts.repr})")
        
    macro initSeq*(t: typedesc, n: varargs[int]): untyped =
        var repStr = ""
        for i, arg in n:
            if i == n.len - 1:
                repStr &= &"newSeq[{t}]({arg.repr}) "
            else:
                repStr &= &"({arg.repr}).newSeqWith "
        parseExpr(repStr)
    
    
    proc `-`*(a,b: char): int = ord(a) - ord(b)
    proc `+`*(a: char,b: int): char = char(ord(a) + b)
    proc `-`*(a: char,b: int): char = char(ord(a) - b)
    proc `++`*(a: var int) = a += 1
    proc `--`*(a: var int) = a += 1

    proc chmin*[T](a: var T, b: T): bool {.discardable.} =
        if a > b:
            a = b
            return true
        return false
    
    proc chmax*[T](a: var T, b: T): bool {.discardable.} =
        if a < b:
            a = b
            return true
        return false
    const INF* = (1e9+100).int
    const LINF* = (4e18 + 100).int
    discard

proc solve() =
    var
        (N, K, T) = read(int, int, int)
        C = read(string)
        L = -1
        R = -1
        
    for i in countdown(K-2,0):
        if C[i] != C[K - 1]:
            L = i
            break
    for i in countup(K,N-1):
        if C[i] != C[K-1]:
            R = i
            break
    if L != -1 and (K - 1 - L ) mod 2 == T mod 2 and (K - 1 - L) <= T:
        echo (if C[K-1] == 'A': "Alice" else: "Bob")
        return
    if R != -1 and (R - K + 1) mod 2 == T mod 2 and (R - K + 1) <= T:
        echo (if C[K-1] == 'A': "Alice" else: "Bob")
        return
    
    echo if C[K-1] == 'A': "Bob" else: "Alice"
        

solve()
0