結果
| 問題 | No.769 UNOシミュレータ | 
| コンテスト | |
| ユーザー |  toshiro_yanagi | 
| 提出日時 | 2018-12-29 12:18:18 | 
| 言語 | Nim (2.2.0) | 
| 結果 | 
                                CE
                                 
                            (最新) 
                                AC
                                 
                            (最初) | 
| 実行時間 | - | 
| コード長 | 1,022 bytes | 
| コンパイル時間 | 811 ms | 
| コンパイル使用メモリ | 65,268 KB | 
| 最終ジャッジ日時 | 2024-11-14 20:44:40 | 
| 合計ジャッジ時間 | 1,853 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge1 | 
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
            
            
            
            
            ただし、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, 8) Error: undeclared identifier: 'lc'
ソースコード
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()
            
            
            
        