結果

問題 No.769 UNOシミュレータ
ユーザー toshiro_yanagitoshiro_yanagi
提出日時 2018-12-29 12:24:22
言語 Nim
(2.0.2)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,111 bytes
コンパイル時間 791 ms
コンパイル使用メモリ 64,324 KB
最終ジャッジ日時 2024-04-27 02:45:46
合計ジャッジ時間 1,312 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 8) Warning: Use the new 'sugar' module instead; future is deprecated [Deprecated]
/home/judge/data/code/Main.nim(23, 9) Error: undeclared identifier: 'lc'

ソースコード

diff #

import future, strutils


proc nextString: string =
    result = ""
    while not endOfFile stdin:
        let nextChar = readChar stdin
        case nextChar
        of '\r':
            discard
        of "\n"[0], ' ':
            break
        else:
            add result, nextChar


proc nextInt: int =
    return parseInt nextString()


let
    n, m = nextInt()
    l = lc[nextString() | (i <- 0 ..< m), string]
var
    P = lc[0 | (j <- 0 ..< n), int]
    j = -1
    flg = 1
    id: int
    k = 1


proc main: void =
    for i in 0 ..< m:
        j += flg
        j = (j + n) mod n
        id = j + 1

        P[j] += 1
        let li = l[i]
        case li
        of "number":
            discard
        of "drawtwo", "drawfour":
            if i <= m - 2 and li != l[i + 1]:
                j += flg
                P[(j + n) mod n] -= [2, 4][int(li != "drawtwo")] * k
                k = 1
            else:
                k += 1
        of "skip":
            j += flg
        of "reverse":
            flg *= -1

    writeLine stdout, "$# $#".format(id, P[id - 1])


when isMainModule:
    main()
0