結果

問題 No.154 市バス
ユーザー hanorverhanorver
提出日時 2016-06-10 17:13:31
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 508 bytes
コンパイル時間 605 ms
コンパイル使用メモリ 65,484 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-21 09:29:26
合計ジャッジ時間 1,206 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<iostream>
#include<string>

void solve() {
	std::string s;

	std::cin >> s;

	int green = 0;
	for (int i = 0; i < s.length(); i++) {
		if (s[i] == 'G') green++;
		if (s[i] == 'R') {
			if (green == 0) {
				std::cout << "impossible" << std::endl;
				return ;
			}
			green--;
		}
	}

	if (green == 0) {
		std::cout << "possible" << std::endl;
	} else {
		std::cout << "impossible" << std::endl;
	}
}

int main() {
	int n;

	std::cin >> n;

	for (int i = 0; i < n; i++) {
		solve();
	}

	return 0;
}
0