結果

問題 No.154 市バス
ユーザー yosswi414yosswi414
提出日時 2018-09-19 15:31:57
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 353 bytes
コンパイル時間 1,106 ms
コンパイル使用メモリ 143,672 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-25 10:09:44
合計ジャッジ時間 2,304 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 24 ms
4,376 KB
testcase_01 AC 24 ms
4,376 KB
testcase_02 AC 24 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:6: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
 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')continue;
            b+=(s[i]=='G'?1:-1);
            if(b<0){cout<<"impossible\n";break;}
        }
        cout<<(b?"im":"")<<"possible\n";
    }
}
0