結果
問題 |
No.154 市バス
|
ユーザー |
|
提出日時 | 2020-10-10 20:47:07 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 881 bytes |
コンパイル時間 | 1,550 ms |
コンパイル使用メモリ | 166,404 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-20 16:58:17 |
合計ジャッジ時間 | 2,403 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | AC * 6 WA * 2 |
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for(int i=0;i<(int)(n);i++) using namespace std; using ll = long long ; using P = pair<int,int> ; using pll = pair<long long,long long>; constexpr int INF = 1e9; constexpr long long LINF = 1e17; constexpr int MOD = 1000000007; constexpr double PI = 3.14159265358979323846; int main(){ int t; cin >> t; while(t--){ string s; cin >> s; bool ok = true; int g = 0,r = 0; int w = 0; for(int i=0;i<s.size();i++){ if(s[i] == 'G') g++; else if(s[i] == 'R'){ if(g == 0){ ok = false; break; } else --g,++r; }else ++w; } if(g == 0 && ok && r > 0 && w >= r) cout << "possible" << endl; else cout << "impossible" << endl; } return 0; }