結果
| 問題 |
No.769 UNOシミュレータ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-01-31 19:40:20 |
| 言語 | Ruby (3.4.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 931 bytes |
| コンパイル時間 | 104 ms |
| コンパイル使用メモリ | 7,296 KB |
| 実行使用メモリ | 54,564 KB |
| 最終ジャッジ日時 | 2024-11-22 09:07:54 |
| 合計ジャッジ時間 | 6,966 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 17 WA * 6 |
コンパイルメッセージ
Syntax OK
ソースコード
N, M = gets.split.map(&:to_i)
cards = Hash.new(0)
current_user_index = 0
increment = 1
ops = readlines.map(&:chomp)
op = ops.shift
prev_op = nil
stack_cards = 0
loop do
break if ops.empty?
if op != 'drawtwo' && prev_op == 'drawtwo' ||
op != 'drawfour' && prev_op == 'drawfour'
cards[current_user_index] -= stack_cards
stack_cards, prev_op = 0, nil
current_user_index += increment
current_user_index = current_user_index % N
next
end
cards[current_user_index] += 1
if op == 'skip'
current_user_index += increment * 2
elsif op == 'reverse'
increment = -increment
current_user_index += increment
else
stack_cards += 2 if op == 'drawtwo'
stack_cards += 4 if op == 'drawfour'
current_user_index += increment
end
current_user_index = current_user_index % N
prev_op = op
op = ops.shift
end
puts [current_user_index + 1, cards[current_user_index] + 1].join(' ')