結果
| 問題 | No.154 市バス |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-03-14 23:08:28 |
| 言語 | PyPy2 (7.3.15) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 513 bytes |
| 記録 | |
| コンパイル時間 | 134 ms |
| コンパイル使用メモリ | 77,724 KB |
| 最終ジャッジ日時 | 2025-12-03 19:49:49 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | MLE * 1 |
| other | MLE * 8 |
ソースコード
# coding: utf-8
#yuki_154
t=int(raw_input())
for i in xrange(t):
s=raw_input()
rgcount=0
rflag=False
gflag=False
if len(s)==1:
print "impossible"
continue
if s=="GR":
print "impossible"
continue
pi=True
for j in xrange(len(s)-1,-1,-1):
st=s[j]
if st=='R':
rgcount+=1
rflag=True
elif st=='G':
rgcount-=1
gflag=True
elif st=='W':
if rflag==False or gflag==False:
pi=False
break
if rgcount<0:
pi=False
if pi==True:
print "possible"
else:
print "impossible"