結果

問題 No.769 UNOシミュレータ
ユーザー むらためむらため
提出日時 2018-12-18 01:29:28
言語 Nim
(2.0.2)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 959 bytes
コンパイル時間 3,166 ms
コンパイル使用メモリ 69,468 KB
実行使用メモリ 21,624 KB
最終ジャッジ日時 2023-08-14 11:55:53
合計ジャッジ時間 5,316 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 6 ms
4,380 KB
testcase_10 AC 5 ms
4,376 KB
testcase_11 AC 6 ms
4,376 KB
testcase_12 AC 46 ms
9,500 KB
testcase_13 AC 45 ms
9,448 KB
testcase_14 AC 46 ms
9,452 KB
testcase_15 AC 92 ms
15,844 KB
testcase_16 AC 93 ms
15,972 KB
testcase_17 AC 93 ms
15,908 KB
testcase_18 AC 132 ms
21,564 KB
testcase_19 AC 133 ms
21,624 KB
testcase_20 AC 132 ms
21,580 KB
testcase_21 AC 133 ms
21,492 KB
testcase_22 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
/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]

ソースコード

diff #

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()
0