結果
問題 | No.154 市バス |
ユーザー |
![]() |
提出日時 | 2020-05-27 20:46:15 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 674 bytes |
コンパイル時間 | 1,452 ms |
コンパイル使用メモリ | 166,544 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-13 03:47:39 |
合計ジャッジ時間 | 2,480 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | AC * 6 WA * 2 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { int T; cin >> T; while (T--) { string S; cin >> S; bool flag = true; int cnt[1010] = {}; for (auto& c : S) { if (c == 'W') cnt[0]++; else if (c == 'G') if (cnt[0] == 0) flag = false; else cnt[0]--, cnt[1]++; else if (cnt[1] == 0) flag = false; else cnt[1]--, cnt[2]++; } if (cnt[1]) flag = false; cout << (flag ? "" : "im") << "possible" << endl; } }