結果

問題 No.154 市バス
ユーザー takakintakakin
提出日時 2020-05-01 18:13:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 373 bytes
コンパイル時間 96 ms
コンパイル使用メモリ 10,744 KB
実行使用メモリ 8,012 KB
最終ジャッジ日時 2023-08-26 00:35:07
合計ジャッジ時間 2,200 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 142 ms
7,872 KB
testcase_01 AC 146 ms
7,784 KB
testcase_02 AC 142 ms
7,796 KB
testcase_03 AC 140 ms
7,956 KB
testcase_04 WA -
testcase_05 AC 16 ms
7,804 KB
testcase_06 AC 16 ms
7,828 KB
testcase_07 AC 171 ms
7,976 KB
testcase_08 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=lambda: sys.stdin.readline().rstrip()
t=int(input())
for _ in range(t):
  S=input()[::-1]
  w,g,r=0,0,0
  chk=True
  for s in S:
    if s=="W":
      if g==0:
        chk=False
    elif s=="G":
      if r==0:
        chk=False
      else:
        r-=1
        g+=1
    else:
      r+=1
  if r>0:
    chk=False
  print("possible" if chk else "impossible")

0