結果
| 問題 | No.154 市バス |
| コンテスト | |
| ユーザー |
TANIGUCHI Kousuke
|
| 提出日時 | 2015-11-06 15:56:29 |
| 言語 | Ruby (4.0.2) |
| 結果 |
AC
|
| 実行時間 | 819 ms / 2,000 ms |
| コード長 | 613 bytes |
| 記録 | |
| コンパイル時間 | 57 ms |
| コンパイル使用メモリ | 9,088 KB |
| 実行使用メモリ | 15,360 KB |
| 最終ジャッジ日時 | 2026-04-30 16:33:37 |
| 合計ジャッジ時間 | 6,019 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 8 |
コンパイルメッセージ
Syntax OK
ソースコード
n = gets.to_i
n.times do
lines = []
s = gets.chomp.chars.reverse
s.each do |c|
if c == 'R'
lines << 0
elsif c == 'G'
g = lines.index(0)
if g
lines[g] = 1
else
lines << -1
break
end
else
w = lines.index(1) || lines.index(2)
if w
lines[w] = 2 if lines[w] == 1
else
lines << -1
break;
end
end
end
puts lines.all? {|v| v == 2 } ? "possible" : "impossible"
end
TANIGUCHI Kousuke