結果
問題 | No.154 市バス |
ユーザー |
![]() |
提出日時 | 2017-02-05 21:20:56 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 572 bytes |
コンパイル時間 | 628 ms |
コンパイル使用メモリ | 59,480 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-13 08:57:23 |
合計ジャッジ時間 | 1,067 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | WA * 8 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:5:33: warning: ‘s’ is used uninitialized [-Wuninitialized] 5 | #define rep(n) for(int i = 0; i < n; ++i) | ^ main.cpp:8:16: note: ‘s’ was declared here 8 | int t, s; | ^
ソースコード
#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, s;cin >> t;rep(s) {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;}}}