結果

問題 No.154 市バス
ユーザー kyuridenamidakyuridenamida
提出日時 2016-07-22 18:51:55
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 627 bytes
コンパイル時間 1,601 ms
コンパイル使用メモリ 160,356 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-21 09:52:17
合計ジャッジ時間 2,306 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
5,248 KB
testcase_01 AC 66 ms
5,376 KB
testcase_02 AC 68 ms
5,376 KB
testcase_03 AC 59 ms
5,376 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 48 ms
5,376 KB
testcase_08 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

typedef complex<double> P;
int main(){
	string s;
	cin >> s;
	while( cin >> s ){
		int use = 0;
		while( s.size() ){
			if( s.back() == 'W' ){
				if( use == 0 ) break; 
				else s = s.substr(0,s.size()-1);
			}else if( s.back() == 'R'){
				int f = 0;
				for(int i = s.size() - 1 ; i >= 0 ; i--){
					if( s[i] == 'G'){
						s = s.substr(0,s.size()-1);
						s.erase(s.begin()+i);
						f = 1;
						break;
					}
				}		

				if(!f) break;	
				use = 1;
			}else{
				break;
			}

		}
		if( s.size() == 0 ) cout << "possible" << endl;
		else cout << "impossible" << endl;
	}
}
0