結果
問題 | No.154 市バス |
ユーザー | 小指が強い人 |
提出日時 | 2015-11-23 17:16:37 |
言語 | C++11 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 723 bytes |
コンパイル時間 | 474 ms |
コンパイル使用メモリ | 57,136 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-04-21 08:58:29 |
合計ジャッジ時間 | 1,340 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 26 ms
6,812 KB |
testcase_01 | AC | 26 ms
6,944 KB |
testcase_02 | AC | 26 ms
6,940 KB |
testcase_03 | AC | 25 ms
6,940 KB |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | AC | 2 ms
6,944 KB |
testcase_07 | AC | 23 ms
6,944 KB |
testcase_08 | WA | - |
ソースコード
#include <iostream> #include <string> using namespace std; int main(void) { int t; cin >> t; for(int i = 0; i < t; i++) { string str; int stack = 0; cin >> str; int size = str.size(); if(size < 3 || str[size - 1] == 'W') { cout << "impossible" << endl; continue; } for(int j = 0; j < size; j++) { if(str[j] == 'G') stack++; else if(str[j] == 'R') stack--; if(stack < 0) break; } if(stack == 0) cout << "possible" << endl; else cout << "impossible" << endl; } return 0; }