結果

問題 No.154 市バス
ユーザー yosswi414yosswi414
提出日時 2018-09-19 16:15:04
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 672 bytes
コンパイル時間 1,491 ms
コンパイル使用メモリ 165,552 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-25 10:10:18
合計ジャッジ時間 2,318 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 1 ms
4,376 KB
testcase_07 WA -
testcase_08 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:3:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
    3 | main(){
      | ^~~~

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
main(){
    int t;
    string s;
    cin>>t;
    while(t--){
        cin>>s;
        int b=0,f=0,w=0;
        for(int i=0;i<s.length();++i){
            switch(s[i]){
            case 'W':
                w++;
                break;
            case 'G':
                if(!w){cout<<"impossible\n";f++;break;}
                b++;w=0;
                break;
            case 'R':
                if(!b){cout<<"impossible\n";f++;break;}
                b--;w=0;
                break;
            }
            if(f)break;
        }
        if(f)continue;
        cout<<(!b&&s[s.length()-1]=='R'?"":"im")<<"possible\n";
    }
}
0