結果
問題 | No.154 市バス |
ユーザー |
|
提出日時 | 2015-06-06 17:40:08 |
言語 | C++11 (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 932 bytes |
コンパイル時間 | 568 ms |
コンパイル使用メモリ | 82,368 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-13 07:26:54 |
合計ジャッジ時間 | 1,291 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | AC * 6 WA * 2 |
ソースコード
#include <algorithm> #include <bitset> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> #define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++) using namespace std; typedef long long int ll; typedef vector<int> VI; typedef pair<int, int> PI; const double EPS=1e-9; bool solve(const string &s) { int n = s.length(); int w = 0, g = 0, r = 0; REP(i, 0, n) { switch(s[i]) { case 'W': w++;break; case 'G': g++; break; case 'R': r++;break; default: return 0; } if (w < g || w < r || g < r) { return 0; } } return g == r; } int main(void){ int t; cin >> t; REP (loop_var, 0, t) { string s; cin >> s; cout << (solve(s) ? "possible" : "impossible") << endl; } }