結果
問題 | No.154 市バス |
ユーザー | 夜 |
提出日時 | 2020-12-23 19:22:04 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 28 ms / 2,000 ms |
コード長 | 763 bytes |
コンパイル時間 | 760 ms |
コンパイル使用メモリ | 93,392 KB |
実行使用メモリ | 4,348 KB |
最終ジャッジ日時 | 2023-10-21 15:16:01 |
合計ジャッジ時間 | 1,591 ms |
ジャッジサーバーID (参考情報) |
judge9 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 28 ms
4,348 KB |
testcase_01 | AC | 27 ms
4,348 KB |
testcase_02 | AC | 27 ms
4,348 KB |
testcase_03 | AC | 28 ms
4,348 KB |
testcase_04 | AC | 27 ms
4,348 KB |
testcase_05 | AC | 2 ms
4,348 KB |
testcase_06 | AC | 2 ms
4,348 KB |
testcase_07 | AC | 23 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, g = 0, r = 0; int w1 = 0; bool n = true; for (int j = 0; j < s.size(); j++) { if (s[j] == 'W') { w++; w1++; } else if (s[j] == 'G') { g++; w1 = 0; } else { r++; } if (w < g || g < r) { n = false; } } if (n && g == r && w1 == 0) { cout << "possible" << endl; } else { cout << "impossible" << endl; } } }