結果
問題 |
No.154 市バス
|
ユーザー |
![]() |
提出日時 | 2018-03-09 13:37:32 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 717 bytes |
コンパイル時間 | 480 ms |
コンパイル使用メモリ | 55,680 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-08 06:19:14 |
合計ジャッジ時間 | 1,445 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | AC * 6 WA * 2 |
ソースコード
#include<iostream> #include<string> using namespace std; int main(){ int N; int Gcheck,Rcheck; string input; bool flag; cin >> N; for(int i=0;i<N;i++){ flag = true; Gcheck = 0; Rcheck = 0; cin >> input; for(int j=0;j<input.length();j++){ if(input[j] == 'W') Gcheck++; else if(input[j] == 'R') Rcheck--; else{ Gcheck--; Rcheck++; } if(Gcheck<0 || Rcheck < 0){ flag = false; break; } } if(flag && Rcheck == 0) cout << "possible" << endl; else cout << "impossible" << endl; } return 0; }