結果

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

テストケース

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

ソースコード

diff #

#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <deque>
#include <algorithm>
#include <iomanip>

#define REP(i, n) for(int i = 0;i < (n); i++)
#define REP2(i, x, n) for(int i = (x); i < (n); i++)
#define REPR(i, n) for(int i = (n); i >= 0; i--)

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())

#define LL long long
#define LD long double

#define PI 3.14159265358979

using namespace std;

//================================================
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	int T;
	cin >> T;
	vector<string>ans(T);

	int wCount = 0;
	int gCount = 0;
	int rCount = 0;
	string S = "";

	REP(i, T) {
		cin >> S;
		if (S.substr(S.size() - 1, 1) != "R") {
			ans[i] = "impossible";
			continue;
		}

		REP(j, S.size()) {
			if (S[j] == 'W') wCount++;
			if (S[j] == 'G') gCount++;
			if (S[j] == 'R') rCount++;	
		}

		if (gCount == rCount && gCount <= wCount) {
			ans[i] = "possible";
		} else {
			ans[i] = "impossible";
		}
	}

	REP(i, T) cout << ans[i] << "\n";
	return 0;
}
0