結果

問題 No.154 市バス
ユーザー angel_p_57angel_p_57
提出日時 2016-06-10 22:11:07
言語 Ruby
(3.3.0)
結果
AC  
実行時間 346 ms / 2,000 ms
コード長 237 bytes
コンパイル時間 192 ms
コンパイル使用メモリ 7,296 KB
実行使用メモリ 13,568 KB
最終ジャッジ日時 2024-04-21 09:30:29
合計ジャッジ時間 3,481 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 343 ms
13,312 KB
testcase_01 AC 346 ms
13,568 KB
testcase_02 AC 340 ms
13,312 KB
testcase_03 AC 322 ms
13,568 KB
testcase_04 AC 346 ms
13,440 KB
testcase_05 AC 91 ms
12,032 KB
testcase_06 AC 91 ms
12,032 KB
testcase_07 AC 346 ms
13,440 KB
testcase_08 AC 91 ms
12,160 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

gets
$<.each{|s|
 r=g=n=0
 puts s.chop.chars.reverse_each{|c|
  case c
  when ?R
    r+=1
  when ?G
    break if 0>r-=1
    g+=1
  else
    (break if n<1;next)if g<1
    g-=1
    n+=1
  end
 }&&n>0&&r<1&&g<1 ? "possible" : "impossible"
}
0