結果
問題 |
No.154 市バス
|
ユーザー |
|
提出日時 | 2017-11-28 01:37:45 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 659 bytes |
コンパイル時間 | 1,201 ms |
コンパイル使用メモリ | 158,832 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-13 09:16:47 |
合計ジャッジ時間 | 2,046 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | AC * 1 WA * 7 |
ソースコード
#include "bits/stdc++.h" using namespace std; #define print(x) cout<<x<<endl; #define rep(i,a,b) for(int i=a;i<b;i++) #define REP(i,a) for(int i=0;i<a;i++) #define GET_ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0])) typedef long long ll; typedef pair<int, int> PI; typedef pair<int, PI> V; typedef vector<int> VE; const ll mod = 1000000007; int main(){ int n; cin>>n; REP(i,n){ string s; cin>>s; int cnt=0; bool flag=1; REP(j,GET_ARRAY_SIZE(s)){ if(s[j]=='G'){cnt++;} else if(s[j]=='R'){cnt--;} if(cnt<0)flag=0; //print(s[j]<<" "<<cnt); } string ans=cnt==0&&flag?"possible":"impossible"; print(ans); } }