結果
| 問題 |
No.154 市バス
|
| コンテスト | |
| ユーザー |
TANIGUCHI Kousuke
|
| 提出日時 | 2015-11-06 15:56:29 |
| 言語 | Ruby (3.4.1) |
| 結果 |
AC
|
| 実行時間 | 1,242 ms / 2,000 ms |
| コード長 | 613 bytes |
| コンパイル時間 | 48 ms |
| コンパイル使用メモリ | 7,552 KB |
| 実行使用メモリ | 13,568 KB |
| 最終ジャッジ日時 | 2024-10-13 07:49:27 |
| 合計ジャッジ時間 | 8,428 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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