結果
| 問題 | No.154 市バス |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-10-18 11:36:55 |
| 言語 | Ruby (4.0.6 + ACL) |
| 結果 |
WA
不安定
|
| 実行時間 | - |
| コード長 | 422 bytes |
| 記録 | |
| コンパイル時間 | 9 ms |
| コンパイル使用メモリ | 8,960 KB |
| 実行使用メモリ | 15,104 KB |
| 最終ジャッジ日時 | 2026-09-15 13:32:11 |
| 合計ジャッジ時間 | 2,915 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | AC * 4 WA * 4 |
コンパイルメッセージ
Syntax OK
ソースコード
ws = 0
gs = 0
gets.to_i.times do
possible = true
gets.chomp.chars.each do |c|
case c
when "W"
ws += 1
when "G"
if ws <= 0
possible = false
break
end
ws -= 1
gs += 1
when "R"
if gs <= 0
possible = false
break
end
gs -= 1
end
end
if possible && gs.zero?
puts "possible"
else
puts "impossible"
end
end