結果
問題 | No.154 市バス |
ユーザー |
![]() |
提出日時 | 2017-02-05 21:23:36 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 569 bytes |
コンパイル時間 | 410 ms |
コンパイル使用メモリ | 59,768 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-13 08:57:27 |
合計ジャッジ時間 | 1,221 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | AC * 5 WA * 3 |
ソースコード
#include <cstdio>#include <iostream>#include <cmath>#include <string>#define rep(n) for(int i = 0; i < n; ++i)using namespace std;int main(void) {int t;cin >> t;rep(t) {int c = 0;bool flag = true;string str;cin >> str;rep(str.size()) {if (str[i] == 'G') {++c;}else if (str[i] == 'R') {--c;}if (c < 0) {flag = false;break;}}if (flag) {if (c == 0) {cout << "possible" << endl;}else {cout << "impossible" << endl;}}else {cout << "impossible" << endl;}}}