結果

問題 No.154 市バス
ユーザー Miutsuru kariya
提出日時 2016-06-30 09:33:02
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 646 bytes
コンパイル時間 677 ms
コンパイル使用メモリ 63,744 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-13 08:36:47
合計ジャッジ時間 1,429 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other AC * 6 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>

int main()
{
    int T;
    std::cin >> T;
    for (int i = 0; i < T; ++i) {
        std::string S;
        std::cin >> S;
        int W = 0;
        int G = 0;
        int R = 0;
        bool ng = false;
        for (auto c : S) {
            if (c == 'W') {
                ++W;
            } else if (c == 'G') {
                ++G;
                ng = G > W;
            } else {
                ++R;
                ng = R > G;
            }
            if (ng) {
                break;
            }
        }
        ng = ng || G != R;
        std::cout << (ng ? "im" : "") << "possible\n";
    }
}
0