結果
| 問題 | No.769 UNOシミュレータ | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2018-12-18 01:29:28 | 
| 言語 | Nim (2.2.0) | 
| 結果 | 
                                WA
                                 
                            (最新) 
                                AC
                                 
                            (最初) | 
| 実行時間 | - | 
| コード長 | 959 bytes | 
| コンパイル時間 | 3,863 ms | 
| コンパイル使用メモリ | 67,192 KB | 
| 実行使用メモリ | 14,208 KB | 
| 最終ジャッジ日時 | 2024-11-22 08:48:44 | 
| 合計ジャッジ時間 | 5,889 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 22 WA * 1 | 
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 41) Warning: imported and not used: 'sugar' [UnusedImport] /home/judge/data/code/Main.nim(1, 54) Warning: imported and not used: 'strformat' [UnusedImport] /home/judge/data/code/Main.nim(1, 26) Warning: imported and not used: 'algorithm' [UnusedImport] /home/judge/data/code/Main.nim(1, 36) Warning: imported and not used: 'math' [UnusedImport]
ソースコード
import sequtils,strutils,algorithm,math,sugar,macros,strformat
template get*():string = stdin.readLine().strip()
macro unpack*(arr: auto,cnt: static[int]): auto =
  let t = genSym(); result = quote do:(let `t` = `arr`;())
  for i in 0..<cnt: result[1].add(quote do:`t`[`i`])
let (n,m) = get().split().map(parseInt).unpack(2)
let L = newSeqWith(m,get())
var me = 0
var isUp = true
var draw = 0
var preDraw = 0
var C = newSeq[int](n)
proc nextTurn() =
  if isUp: me = (me + 1) mod n
  else: me = (me - 1 + n) mod n
for i,l in L:
  # echo me + 1," ",l
  if draw > 0 and not (l == "drawtwo" and preDraw == 2) and not (l == "drawfour" and preDraw == 4):
    C[me] += draw
    draw = 0
    nextTurn()
  C[me] -= 1
  case l
  of "drawtwo":
    draw += 2
    preDraw = 2
  of "drawfour":
    draw += 4
    preDraw = 4
  of "reverse": isUp = not isUp
  of "skip": nextTurn()
  else: discard
  if i == L.len() - 1:
    echo me + 1," ",-C[me]
    quit(0)
  nextTurn()
            
            
            
        