結果
問題 | No.154 市バス |
ユーザー |
|
提出日時 | 2020-04-22 11:17:31 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 602 bytes |
コンパイル時間 | 808 ms |
コンパイル使用メモリ | 67,164 KB |
最終ジャッジ日時 | 2025-01-09 22:27:47 |
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | AC * 5 WA * 3 |
ソースコード
#include <iostream>#include <string>void solve() {std::string s;std::cin >> s;int cnt = 0;for (char c : s) {if (c == 'G') {++cnt;} else if (c == 'R') {--cnt;if (cnt < 0) {std::cout << "impossible" << std::endl;return;}}}std::cout << (cnt == 0 ? "possible" : "impossible")<< std::endl;}int main() {std::cin.tie(nullptr);std::ios::sync_with_stdio(false);int q;std::cin >> q;while (q--) solve();return 0;}