結果
| 問題 | No.154 市バス |
| コンテスト | |
| ユーザー |
horiesiniti
|
| 提出日時 | 2016-07-20 14:31:36 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 623 bytes |
| 記録 | |
| コンパイル時間 | 545 ms |
| コンパイル使用メモリ | 74,992 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-04-30 17:41:51 |
| 合計ジャッジ時間 | 1,734 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | AC * 4 WA * 4 |
ソースコード
#include <iostream>
#include <string>
#include <algorithm>
#include <stdio.h>
void f(){
//始発バスがいきなり終バスということも考慮すると?
int g=0,r=0;
std::string str;
std::cin>>str;
std::reverse(str.begin(),str.end());
for(int i=0;i<str.size();i++){
char c=str[i];
if((((r==0)||(g==0)))&&(c=='w')){
printf("impossible\n");
return;
}
if(c=='G'){
g++;
}else if(c=='R'){
r++;
}
if(g>r){
printf("impossible\n");
return ;
}
}
printf("possible\n");
}
int main() {
// your code goes here
int n;
scanf("%d",&n);
for(int i=0;i<n;i++){
f();
}
return 0;
}
horiesiniti