結果
問題 |
No.154 市バス
|
ユーザー |
![]() |
提出日時 | 2015-07-28 08:36:50 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 511 bytes |
コンパイル時間 | 1,274 ms |
コンパイル使用メモリ | 158,936 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-13 07:33:04 |
合計ジャッジ時間 | 2,042 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | AC * 2 WA * 6 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; for (int i = 0; i < t; ++i) { string s; cin >> s; reverse(s.begin(), s.end()); while (s.back() == 'W') s.pop_back(); int a = 0, b = 0, c = 0; bool p = true; for (char t : s) { if (t == 'W') ++a; if (t == 'G') ++b; if (t == 'R') ++c; if (a > b) p = false; if (b > c) p = false; } if (b != c) p = false; cout << (p ? "possible" : "impossible") << endl; } }