結果
問題 | No.154 市バス |
ユーザー |
![]() |
提出日時 | 2015-02-17 23:41:19 |
言語 | C++11 (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 588 bytes |
コンパイル時間 | 366 ms |
コンパイル使用メモリ | 55,512 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-13 06:22:42 |
合計ジャッジ時間 | 1,078 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | AC * 6 WA * 2 |
ソースコード
#include <iostream> #include <string> using namespace std; int main() { int T; cin>>T; while (T--) { string s; cin>>s; int n=s.size(); int c[128]={}; int& r=c['R'], &g=c['G'], &w=c['W']; bool possible=true; for(int i=0;i<n;++i) { if (g<r or w<r) { possible=false; break; } c[s[i]]++; } for(int i=n-1;i>=0&&s[i]!='R'&&possible;--i) if (s[i]=='W' or s[i]=='G') possible=false; if (r!=g or r>w) possible=false; cout<<(possible?"possible":"impossible")<<endl; } }