結果
| 問題 |
No.769 UNOシミュレータ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-12-16 22:26:33 |
| 言語 | Ruby (3.4.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,161 bytes |
| コンパイル時間 | 52 ms |
| コンパイル使用メモリ | 7,296 KB |
| 実行使用メモリ | 36,224 KB |
| 最終ジャッジ日時 | 2024-11-22 08:41:54 |
| 合計ジャッジ時間 | 5,893 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 WA * 3 |
コンパイルメッセージ
Syntax OK
ソースコード
def ascan; gets.split.map(&:to_i); end
N, M = ascan
turn = 0
vec = 1
numcards = [1]*N
lastturn = 0
commands = M.times.map{gets.chomp}
idx = 0
while idx < M
lastturn = turn
c = commands[idx]
case c
when 'number'
numcards[turn] += 1
turn += 1*vec
when 'drawtwo'
numcards[turn] += 1
d = 2
while commands[idx+1] == 'drawtwo'
lastturn = turn
turn = (turn + vec + N) % N
numcards[turn] += 1
d += 2
idx += 1
end
numcards[(turn+vec)%N] -= d
turn += 2*vec
when 'drawfour'
numcards[turn] += 1
d = 4
while commands[idx+1] == 'drawfour'
lastturn = turn
turn = (turn + vec + N) % N
numcards[turn] += 1
d += 4
idx += 1
end
numcards[(turn+vec)%N] -= d
turn += 2*vec
when 'skip'
numcards[turn] += 1
turn += 2*vec
when 'reverse'
numcards[turn] += 1
vec *= -1
turn += 1*vec
end
turn = (turn + N) % N
idx += 1
end
puts "#{lastturn+1} #{numcards[lastturn]-1}"