結果
問題 |
No.154 市バス
|
ユーザー |
👑 |
提出日時 | 2020-02-05 20:25:34 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 716 bytes |
コンパイル時間 | 558 ms |
コンパイル使用メモリ | 67,664 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-22 22:22:37 |
合計ジャッジ時間 | 1,348 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | AC * 6 WA * 2 |
ソースコード
#include <iostream> #include <algorithm> using namespace std; int main(){ int t;cin>>t; while(t--){ string s;cin>>s; reverse(s.begin(),s.end()); int nw = 0; bool ok = false; bool ans = true; for(int i = 0; s.size() > i; i++){ if(s[i] == 'R')nw++; else if(s[i] == 'G'){ nw--; ok = true; if(nw < 0){ ans = false; break; } }else{ if(!ok){ ans = false; break; } } } cout << (ans&&ok?"possible":"impossible") << endl; } }