結果
問題 | No.154 市バス |
ユーザー |
![]() |
提出日時 | 2020-05-01 18:18:19 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 405 bytes |
コンパイル時間 | 135 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-12-24 13:06:39 |
合計ジャッジ時間 | 2,612 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 7 WA * 1 |
ソースコード
import sysinput=lambda: sys.stdin.readline().rstrip()t=int(input())for _ in range(t):S=input()[::-1]w,g,r=0,0,0chk=Truefor s in S:if s=="W":if g==0:chk=Falseelse:w+=1elif s=="G":if r==0:chk=Falseelse:r-=1g+=1else:r+=1if r>0 or w<g:chk=Falseprint("possible" if chk else "impossible")