結果
問題 | No.154 市バス |
ユーザー |
![]() |
提出日時 | 2018-09-19 16:04:27 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 477 bytes |
コンパイル時間 | 1,329 ms |
コンパイル使用メモリ | 166,464 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-18 08:15:59 |
合計ジャッジ時間 | 1,982 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | AC * 4 WA * 4 |
コンパイルメッセージ
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;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";}}