結果
問題 |
No.154 市バス
|
ユーザー |
|
提出日時 | 2020-12-23 19:10:22 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 861 bytes |
コンパイル時間 | 798 ms |
コンパイル使用メモリ | 93,468 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-21 16:29:25 |
合計ジャッジ時間 | 1,719 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 7 WA * 1 |
ソースコード
#include <iostream> #include <string> #include <algorithm> #include <vector> #include <iomanip> #include <cmath> #include <stdio.h> #include <queue> #include <deque> #include <cstdio> #include <set> #include <map> #include <bitset> #include <stack> #include <cctype> using namespace std; int main() { int t; cin >> t; for (int i = 0; i < t; i++) { string s; cin >> s; int w = 0, w1 = 0, g = 0, g1 = 0, r = 0; bool n = false; for (int j = 0; j < s.size(); j++) { if (s[j] == 'W') { w++; w1++; } else if (s[j] == 'G') { if (w1 != 0) { w1 = 0; } g++; g1++; n = true; } else if (s[j] == 'R') { if (g != 0) { g--; } else { r++; } } } if (n && w >= g1 && w1 == 0 && g == 0 && r == 0) { cout << "possible" << endl; } else { cout << "impossible" << endl; } } }