結果

問題 No.154 市バス
ユーザー ttakanottakano
提出日時 2017-11-28 10:56:27
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 701 bytes
コンパイル時間 1,366 ms
コンパイル使用メモリ 160,420 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-21 10:28:47
合計ジャッジ時間 2,562 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 21 ms
6,940 KB
testcase_08 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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);
  }
}
0