結果
問題 | No.154 市バス |
ユーザー |
|
提出日時 | 2021-11-15 17:40:12 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 687 bytes |
コンパイル時間 | 2,038 ms |
コンパイル使用メモリ | 187,172 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-12-14 23:14:27 |
合計ジャッジ時間 | 3,271 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | AC * 6 WA * 2 |
ソースコード
#define _GLIBCXX_DEBUG#define ll long long#include <bits/stdc++.h>using namespace std;using Graph = vector<vector<int>>;int main(){int T; cin >> T;for(int i = 0; i < T; i++){string S; cin >> S;int s = (int)S.size();int W = 0, G = 0, R = 0;bool flag = true;for(int j = 0; j < s; j++){switch(S[j]){case 'W':W++;break;case 'G':W = 0;G++;break;case 'R':W = 0;R++;if(G < R) flag = false;break;}}if(flag and W == 0 and G == R) cout << "possible" << endl;else cout << "impossible" << endl;}}