結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
4,376 KB
testcase_01 AC 25 ms
4,376 KB
testcase_02 AC 25 ms
4,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 21 ms
4,376 KB
testcase_08 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;
        for(int i=0;i<s.length();++i){
            if(s[i]=='W'){
                if(i==s.length()-1){cout<<"impossible\n";break;}
                else continue;
            }
            b+=(s[i]=='G'?1:-1);
            if(b<0){cout<<"impossible\n";break;}
        }
        cout<<(b||s[s.length()-1]!='R'?"im":"")<<"possible\n";
    }
}
0