結果
| 問題 |
No.154 市バス
|
| コンテスト | |
| ユーザー |
TANIGUCHI Kousuke
|
| 提出日時 | 2015-11-06 16:27:19 |
| 言語 | Ruby (3.4.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 587 bytes |
| コンパイル時間 | 58 ms |
| コンパイル使用メモリ | 7,296 KB |
| 実行使用メモリ | 13,568 KB |
| 最終ジャッジ日時 | 2024-10-13 07:49:48 |
| 合計ジャッジ時間 | 4,294 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 7 WA * 1 |
コンパイルメッセージ
Syntax OK
ソースコード
n = gets.to_i
n.times do
lines = [0,0,0]
s = gets.chomp.chars.reverse
s.each do |c|
if c == 'R'
lines[0] += 1
elsif c == 'G'
if lines[0] > 0
lines[0] -= 1
lines[1] += 1
else
break
end
else
if lines[1] > 0
lines[1] -= 1
lines[2] += 1
elsif lines[2] < 1
break;
end
end
end
puts lines[0] == 0 && lines[1] == 0 && lines[2] > 0 ? "possible" : "impossible"
end
TANIGUCHI Kousuke