結果

問題 No.154 市バス
ユーザー hogeover30hogeover30
提出日時 2016-06-11 23:40:01
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 552 bytes
コンパイル時間 508 ms
コンパイル使用メモリ 65,696 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-21 09:34:05
合計ジャッジ時間 1,291 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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