結果
| 問題 | No.154 市バス |
| コンテスト | |
| ユーザー |
184
|
| 提出日時 | 2015-02-17 23:40:39 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 595 bytes |
| 記録 | |
| コンパイル時間 | 361 ms |
| コンパイル使用メモリ | 72,128 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-04-30 14:48:18 |
| 合計ジャッジ時間 | 2,792 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | AC * 6 WA * 2 |
ソースコード
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
//namaega184
int main(){
int t;scanf("%d",&t);
char s[1001];
for(int i=0;i<t;i++){
scanf("%s",s);
int len=strlen(s);
int w=0,g=0,r=0;
int a=0;
for(int j=0;j<len;j++){
if(s[j]=='W')w++;
else if(s[j]=='G'){
g++;
if(g>w){
a=1;
break;
}
}
else{
r++;
if(r>g||r>w){
a=1;
break;
}
}
}
if(a||!r||!g)printf("impossible\n");
else printf("possible\n");
}
return 0;
}
184