結果

問題 No.154 市バス
ユーザー mocobt
提出日時 2018-06-09 19:16:14
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 752 bytes
コンパイル時間 774 ms
コンパイル使用メモリ 74,684 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-30 12:58:55
合計ジャッジ時間 1,600 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other AC * 4 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

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

using namespace std;

auto T=0;
queue<int> que;

void input(){
    scanf("%d", &T);
}


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

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