結果
| 問題 | No.154 市バス |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-09-21 04:09:07 |
| 言語 | C++23(gcc16) (gcc 16.1.0 + boost 1.92.0 + ACL) |
| 結果 |
WA
不安定
|
| 実行時間 | - |
| コード長 | 499 bytes |
| 記録 | |
| コンパイル時間 | 1,056 ms |
| コンパイル使用メモリ | 173,872 KB |
| 実行使用メモリ | 10,040 KB |
| 最終ジャッジ日時 | 2026-09-21 04:09:10 |
| 合計ジャッジ時間 | 2,619 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | AC * 7 WA * 1 |
ソースコード
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
using ll = long long;
bool solve(){
string s; cin >> s;
int x=0, w=0, rw=0, r=0;
for(auto p:s){
if(p=='W') w++, rw++;
else if(p=='G'){
if(rw==0) return false;
rw--; x++;
}
else{
if(x==0) return false;
x--, w=0, r++;
}
}
return x==0&&w==0&&r;
}
int main(void){
int t; cin >> t;
while(t--){
cout << (solve()?"possible":"impossible") << '\n';
}
return 0;
}