結果
問題 | No.154 市バス |
ユーザー |
![]() |
提出日時 | 2018-09-19 16:15:04 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 672 bytes |
コンパイル時間 | 1,443 ms |
コンパイル使用メモリ | 165,976 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-18 08:16:02 |
合計ジャッジ時間 | 1,959 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 1 WA * 7 |
コンパイルメッセージ
main.cpp:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 3 | main(){ | ^~~~
ソースコード
#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";}}