結果
問題 | No.154 市バス |
ユーザー |
|
提出日時 | 2020-04-22 11:18:58 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 684 bytes |
コンパイル時間 | 1,895 ms |
コンパイル使用メモリ | 67,200 KB |
最終ジャッジ日時 | 2025-01-09 22:27:51 |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | AC * 6 WA * 2 |
ソースコード
#include <iostream>#include <string>void solve() {std::string s;std::cin >> s;int wcnt = 0, gcnt = 0, rcnt = 0;for (char c : s) {if (c == 'W') {++wcnt;} else if (c == 'G') {++gcnt;} else if (c == 'R') {++rcnt;}if (wcnt < gcnt || gcnt < rcnt) {std::cout << "impossible" << std::endl;return;}}std::cout << (gcnt == rcnt ? "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;}