結果

問題 No.154 市バス
ユーザー taba
提出日時 2016-04-16 23:36:51
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 283 bytes
コンパイル時間 59 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2024-10-13 08:17:12
合計ジャッジ時間 2,297 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other AC * 5 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

for _ in[0]*input():
	s=raw_input()
	w=g=r=0
	for c in s[::-1]:
		if c=="R":
			r+=1
		elif c=="G":
			g+=1
			if g>r:
				print"impossible"
				break
		elif c=="W":
			w+=1
			if g>0 and r>0:
				g-=1
				r-=1
				w-=1
	if g==0 and r==0:
		print"possible"
	else:
		print"impossible"
0