結果

問題 No.154 市バス
ユーザー hogeover30
提出日時 2016-06-11 23:40:01
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 552 bytes
コンパイル時間 578 ms
コンパイル使用メモリ 65,024 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-13 08:27:14
合計ジャッジ時間 1,393 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other AC * 7 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
using namespace std;

int main()
{
    int T; cin>>T;
    while (T--) {
        string s; cin>>s;
        int cnt[128]={};
        string res="possible";
        for(auto& c: s) {
            ++cnt[c];
            if (c=='R' and !(cnt['W']>=cnt['G'] and cnt['G']>=cnt['R']))
                res="impossible";
            if (c=='G' and !(cnt['W']>=cnt['G']))
                res="impossible";
        }
        if (cnt['G']!=cnt['R'] or cnt['G']==0)
            res="impossible";

        cout<<res<<endl;
    }
}
0