結果
問題 |
No.154 市バス
|
ユーザー |
![]() |
提出日時 | 2015-07-07 19:45:13 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 473 bytes |
コンパイル時間 | 1,663 ms |
コンパイル使用メモリ | 158,676 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-13 07:31:27 |
合計ジャッジ時間 | 1,999 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | AC * 6 WA * 2 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ int t; cin>>t; while(t--){ string s; cin>>s; int white=0,red=0,green=0; bool possible=true; for(int i=(int)s.size()-1;i>=0;i--){ if(s[i]=='R') red++; else if(s[i]=='G'){ green++; if(green>red){ possible=false; break; } } else{ white++; if(green*red==0){ possible=false; break; } } } if(possible) cout<<"possible"<<endl; else cout<<"impossible"<<endl; } return 0; }