結果
問題 | No.154 市バス |
ユーザー | 夜 |
提出日時 | 2020-12-23 19:10:22 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 861 bytes |
コンパイル時間 | 656 ms |
コンパイル使用メモリ | 93,144 KB |
実行使用メモリ | 4,348 KB |
最終ジャッジ日時 | 2023-10-21 15:15:46 |
合計ジャッジ時間 | 1,726 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge10 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 24 ms
4,348 KB |
testcase_01 | AC | 28 ms
4,348 KB |
testcase_02 | AC | 24 ms
4,348 KB |
testcase_03 | AC | 25 ms
4,348 KB |
testcase_04 | WA | - |
testcase_05 | AC | 1 ms
4,348 KB |
testcase_06 | AC | 2 ms
4,348 KB |
testcase_07 | AC | 21 ms
4,348 KB |
testcase_08 | AC | 2 ms
4,348 KB |
ソースコード
#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; } } }