結果
問題 |
No.154 市バス
|
ユーザー |
![]() |
提出日時 | 2015-02-17 23:33:21 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 730 bytes |
コンパイル時間 | 396 ms |
コンパイル使用メモリ | 57,436 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-13 06:20:30 |
合計ジャッジ時間 | 1,051 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | AC * 5 WA * 3 |
ソースコード
#include <iostream> #include <string> using namespace std; int main() { int T; cin>>T; while (T--) { string s; cin>>s; int n=s.size(); int r=0, g=0, w=0; bool possible=true; for(int i=0;i<n;++i) { if (s[i]=='R') { if (g<r or w<r) { possible=false; break; } ++r; } if (s[i]=='G') { if (g<r or w<r) { possible=false; break; } ++g; } if (s[i]=='W') { if (g<r or w<r) { possible=false; break; } ++w; } } if (r!=g or r>w) possible=false; cout<<(possible?"possible":"impossible")<<endl; } }