結果

問題 No.154 市バス
ユーザー umezoumezo
提出日時 2022-08-12 20:41:23
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 599 bytes
コンパイル時間 1,987 ms
コンパイル使用メモリ 201,496 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-24 06:19:50
合計ジャッジ時間 2,911 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

#include <bits/stdc++.h>
using namespace std;

int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);

  int t;
  cin>>t;
  while(t--){
    string s;
    cin>>s;
    int n=s.size();
    int w=0,g=0,r=0;
    bool b=true;
    rep(i,n){
      if(s[i]=='W') w++;
      else if(s[i]=='G') g++;
      else r++;
      if(w>=g && g>=r) continue;
      b=false;
      break;
    }
    if(b==false || g!=r) cout<<"impossible"<<endl;
    else cout<<"possible"<<endl;
  }
  
  return 0;
}
0