結果
問題 |
No.154 市バス
|
ユーザー |
|
提出日時 | 2025-07-23 13:09:43 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 674 bytes |
コンパイル時間 | 1,994 ms |
コンパイル使用メモリ | 195,520 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-07-23 13:09:46 |
合計ジャッジ時間 | 3,127 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | AC * 7 WA * 1 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); int T; cin >> T; while(T--){ string s; cin >> s; bool ok = true; int open = 0; for(auto c : s){ if(c == 'G') open++; else if(c == 'R') open--; if(open < 0) ok = false; } if(open != 0) ok = false; bool apG = false; if(s.back() != 'R') ok = false; for(int i=s.size(); i--;){ if(s.at(i) == 'G') break; else if(s.at(i) == 'W'){ok = false; break;} } cout << (ok?"possible":"impossible") << "\n"; } }