結果
問題 | No.154 市バス |
ユーザー | kunio_Yb |
提出日時 | 2016-06-20 03:19:57 |
言語 | C++11 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 393 bytes |
コンパイル時間 | 588 ms |
コンパイル使用メモリ | 56,160 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-04-21 09:46:28 |
合計ジャッジ時間 | 1,271 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 23 ms
6,812 KB |
testcase_01 | AC | 23 ms
6,940 KB |
testcase_02 | AC | 23 ms
6,940 KB |
testcase_03 | AC | 23 ms
6,944 KB |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | AC | 2 ms
6,944 KB |
testcase_07 | AC | 24 ms
6,944 KB |
testcase_08 | WA | - |
ソースコード
#include<iostream> using namespace std; bool f(string s){ int g=0,r=0,w=0; char c; for(auto i=s.rbegin(),e=s.rend();i!=e;++i){ c=*i; g+=(c=='G'); r+=(c=='R'); w+=(c=='W'); if(r<g || (r==0&&w!=0)) return false; } return r==g&&r<=w; } int main(){ string s; int n; cin>>n; for(int i=0; i<n; ++i){ cin>>s; cout<<(f(s)?"":"im")<<"possible"<<endl; } }