結果
問題 |
No.154 市バス
|
ユーザー |
|
提出日時 | 2017-11-28 10:56:27 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 701 bytes |
コンパイル時間 | 1,555 ms |
コンパイル使用メモリ | 159,104 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-13 09:17:17 |
合計ジャッジ時間 | 2,235 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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; int w=0; int g=0; int r=0; bool flag=1; REP(j,GET_ARRAY_SIZE(s)){ if(s[j]=='G'){g++;} else if(s[j]=='R'){r++;} else if(s[j]=='W'){w++;} if(w<g||w<r||g<r)flag=0; } string ans=g==r&&flag?"possible":"impossible"; print(ans); } }