結果

問題 No.154 市バス
ユーザー いた
提出日時 2024-12-29 13:54:18
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 363 bytes
コンパイル時間 279 ms
コンパイル使用メモリ 82,364 KB
実行使用メモリ 76,896 KB
最終ジャッジ日時 2024-12-29 13:54:20
合計ジャッジ時間 1,999 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 2 MLE * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

T=int(input())


for i in range(T):
  w=g=r=0
  t=True
  S=input()
  for i,j in enumerate(S):
    if not w>=g>=r:
      print("impossible")
      t=False
      break
    if j=="W":
      w+=1
      la=i
    if j=="G":
      g+=1
      l=i
    if j=="R":
      r+=1
  if t:
    if g==r and g>0 and l>la:
      print("possible")
    else:
      print("impossible")
0