結果

問題 No.154 市バス
ユーザー ctyl_0ctyl_0
提出日時 2015-10-04 18:36:57
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,063 bytes
コンパイル時間 660 ms
コンパイル使用メモリ 82,924 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-21 08:49:01
合計ジャッジ時間 1,547 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;

using namespace std;


int inputValue(){
    int a;
    cin >> a;
    return a;
};

template <typename T>
void output(T a, int precision) {
    if(precision > 0){
        cout << setprecision(precision)  << a << "\n";
    }
    else{
        cout << a << "\n";
    }
}

int main() {
    
    // source code
    
    int N = inputValue();
    
    rep(i, N){
        string s;
        cin >> s;
        
        int check = 0;
        
        rep(j, s.size()){
            if (s[j] == 'G') {
                check++;
            }
            if (s[j] == 'R') {
                check--;
            }
            if (check < 0) {
                break;
            }
        }
        output((check == 0) ? "possible" : "impossible", 0);
    }
    
    return 0;
}
0