結果

問題 No.154 市バス
ユーザー mocobtmocobt
提出日時 2018-06-09 19:22:26
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 843 bytes
コンパイル時間 602 ms
コンパイル使用メモリ 74,788 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-13 02:19:54
合計ジャッジ時間 1,440 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <queue>
#include <string>

using namespace std;

auto T=0;
queue<int> que;

void input(){
    cin >> T;
}

void solve(){
    for(int i=0; i<T; i++){
        string s;
        cin >> s;
        while(!que.empty())que.pop();
        bool fin = false;
        for(int j=0;j< s.length();j++){
            switch(s[j]){
                case 'W':
                    fin = false;
                    break;
                case 'G':
                    fin = false;
                    que.push(1);
                    break;
                case 'R':
                    fin = true;
                    if(que.empty()) break;
                    que.pop();
            }
        }
        if(!que.empty()||!fin) printf("Impossible\n");
        else printf("possible\n");
    }
}

int main(){
    input();
    solve();
}
0