結果
問題 |
No.154 市バス
|
ユーザー |
|
提出日時 | 2015-04-24 12:28:11 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 709 bytes |
コンパイル時間 | 463 ms |
コンパイル使用メモリ | 63,308 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-13 07:20:53 |
合計ジャッジ時間 | 1,154 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | AC * 6 WA * 2 |
ソースコード
#include <iostream> #include <algorithm> #include <vector> #include <string> using namespace std; int main() { string str; int N; cin >> N; for (size_t i = 0; i < N; i++) { cin >> str; vector<int >data; data.resize(3); bool f = 1; for (auto x : str) { if (x == 'W') { data[0]++; } else if (x == 'G') { if (data[0]) { data[1]++; } else { f = 0; } } else if (x == 'R') { if (data[0] && data[1]) { data[0]--; data[1]--; } else { f = 0; } } } if (*str.rbegin() == 'W' || *str.rbegin() == 'G'||data[1]) { f = 0; } cout << (f ? "possible":"impossible") << endl; data.clear(); } return 0; }