結果
| 問題 | No.154 市バス |
| コンテスト | |
| ユーザー |
fiord
|
| 提出日時 | 2015-07-07 19:31:36 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 538 bytes |
| 記録 | |
| コンパイル時間 | 1,146 ms |
| コンパイル使用メモリ | 175,664 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-04-30 16:02:49 |
| 合計ジャッジ時間 | 2,231 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | AC * 7 WA * 1 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
int t; cin>>t;
while(t--){
string s; cin>>s;
int white=0,green=0,red=0;
bool possible=true;
for(int i=0;i<(int)s.size();i++){
if(s[i]=='W') white++;
else if(s[i]=='G'){
green++;
if(green>white){
possible=false;
break;
}
}
else{
red++;
if(red>green){
possible=false;
break;
}
}
}
if(red!=green||red==0) possible=false;
if(possible) cout<<"possible"<<endl;
else cout<<"impossible"<<endl;
}
return 0;
}
fiord