結果
| 問題 |
No.154 市バス
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-09-26 05:50:56 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 722 bytes |
| コンパイル時間 | 2,921 ms |
| コンパイル使用メモリ | 277,512 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-09-26 05:51:01 |
| 合計ジャッジ時間 | 4,057 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | AC * 7 WA * 1 |
ソースコード
// #pragma GCC optimize ("Ofast")
// #pragma GCC optimize ("unroll-loops")
// #pragma GCC target ("avx,avx2,fma")
#include <bits/stdc++.h>
using std::cin, std::cout, std::cerr;
using ll = long long;
bool Solve() {
std::string s; cin >> s;
std::ranges::reverse(s);
int cnt = 0; bool white = 0;
for(char c : s) {
if(c == 'R') cnt ++;
else if(c == 'G') {
if(cnt == 0) return false;
cnt --;
white = 1;
} else {
if(!white) return false;
}
}
return cnt == 0;
}
int main() {
std::ios::sync_with_stdio(false);
int T; cin >> T;
while(T --) {
cout << (Solve() ? "possible" : "impossible") << '\n';
}
}