結果
| 問題 | No.154 市バス |
| コンテスト | |
| ユーザー |
srjywrdnprkt
|
| 提出日時 | 2023-01-19 12:48:52 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
OLE
|
| 実行時間 | - |
| コード長 | 873 bytes |
| 記録 | |
| コンパイル時間 | 630 ms |
| コンパイル使用メモリ | 127,956 KB |
| 実行使用メモリ | 13,312 KB |
| 最終ジャッジ日時 | 2026-06-29 08:22:24 |
| 合計ジャッジ時間 | 4,685 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 1 |
| other | AC * 3 OLE * 1 -- * 4 |
ソースコード
#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <numeric>
#include <deque>
#include <complex>
#include <cassert>
using namespace std;
int main(){
int T, g;
string S;
cin >> T;
while(T){
cin >> S;
g = 0;
if (S.back() != 'R'){
cout << "impossible" << endl;
T--;
continue;
}
for (int i=0; i<S.size(); i++){
if (S[i] == 'G') g++;
else if (S[i] == 'R'){
if (g == 0){
T--;
cout << "impossible" << endl;
continue;
}
else g--;
}
}
cout << (g == 0 ? "possible" : "impossible") << endl;
T--;
}
return 0;
}
srjywrdnprkt