結果
問題 |
No.154 市バス
|
ユーザー |
![]() |
提出日時 | 2016-12-03 19:44:11 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 802 bytes |
コンパイル時間 | 1,500 ms |
コンパイル使用メモリ | 166,356 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-13 08:47:53 |
合計ジャッジ時間 | 2,276 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | AC * 6 WA * 2 |
ソースコード
#include <bits/stdc++.h> //#include <iostream> //#include <cstdio> #define FOR(i, a, b) for(int i = a; i < b; i++) #define REP(i, n) FOR(i, 0, n) #define MOD 1000000007 #define INF 2000000000 typedef long long ll; typedef unsigned long long ull; //typedef Pair<int,int> P; using namespace std; int main(void){ int T; cin >> T; REP(i,T){ string S; cin >> S; int numWG = 0; int numGR = 0; bool flag = false; REP(j, S.length()){ if(S[j]=='W'){ numWG++; }else if(S[j]=='G'){ numWG--; numGR++; }else{ numGR--; } //cout<<numGR<<endl; if(numWG<0||numGR<0){ cout<<"impossible"<<endl; flag=true; break; } } if(flag){ continue; } if(numGR!=0){ cout<<"impossible"<<endl; continue; } cout<<"possible"<<endl; } return 0; }