結果

問題 No.154 市バス
ユーザー tabataba
提出日時 2016-04-16 23:29:25
言語 Python2
(2.7.18)
結果
TLE  
実行時間 -
コード長 390 bytes
コンパイル時間 201 ms
コンパイル使用メモリ 7,072 KB
実行使用メモリ 20,032 KB
最終ジャッジ日時 2024-04-21 09:24:07
合計ジャッジ時間 6,656 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

for _ in[0]*input():
	s=list(raw_input())
	while 1:
		w=g=r=-1
		for i in xrange(len(s)):
			if s[i]=="W" and w==-1:
				w=i
			elif s[i]=="G" and g==-1:
				g=i
			elif s[i]=="R" and r==-1:
				r=i
			if w>=0 and g>=0 and r>=0:
				break
		if w>=0 and g>=0 and r>=0 and w<g<r:
			s[w]=s[g]=s[r]=None
		elif g==-1 and r==-1:
			print"possible"
			break
		else:
			print"impossible"
			break
0