結果
問題 |
No.154 市バス
|
ユーザー |
![]() |
提出日時 | 2020-04-06 00:59:28 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 782 bytes |
コンパイル時間 | 1,894 ms |
コンパイル使用メモリ | 193,188 KB |
最終ジャッジ日時 | 2025-01-09 14:29:54 |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | AC * 6 WA * 2 |
ソースコード
#include<bits/stdc++.h> #define ALL(v) std::begin(v),std::end(v) using lint=long long; using lubl=long double; int main(){ std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false); std::cout.setf(std::ios_base::fixed);std::cout.precision(15); lint q;std::cin>>q; while(q--){ std::string s;std::cin>>s; lint r=0,g=0; bool ng=false; for(char c:std::string(s.rbegin(),s.rend())){ if(c=='R')r++; if(c=='G'){ if(!r--){ ng=true; break; } g++; } if(c=='W'){ g=std::max(0ll,g-1); } } ng|=(g||r); std::cout<<(ng?"impossible":"possible")<<'\n'; } }