結果
問題 |
No.154 市バス
|
ユーザー |
|
提出日時 | 2016-01-09 13:07:12 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 822 bytes |
コンパイル時間 | 508 ms |
コンパイル使用メモリ | 61,448 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-13 07:54:23 |
合計ジャッジ時間 | 1,220 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | AC * 5 WA * 3 |
ソースコード
#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <cstring> #include <algorithm> #include <limits.h> #include <cmath> #include <time.h> #define REP(i,a,b) for(i=a;i<b;i++) #define rep(i,n) REP(i,0,n) using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; int test = 0; /* ここからが本編 */ int main(void) { int i,j,k,l; int T; char S[1005] = ""; cin >> T; while(cin >> S) { int n = strlen(S); int cnt = 0; bool possible = true; rep(i,n) { if(S[i] == 'G') cnt++; else if(S[i] == 'R') cnt--; if(cnt < 0) { possible = false; break; } } /* for(i=n-1;i>-1;i--) { }*/ if(cnt != 0) possible = false; if(possible) puts("possible"); else puts("impossible"); } return 0; }