結果

問題 No.154 市バス
コンテスト
ユーザー mocobt
提出日時 2018-06-09 19:16:14
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 752 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 653 ms
コンパイル使用メモリ 91,052 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2026-03-20 12:43:36
合計ジャッジ時間 1,045 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other AC * 4 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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