結果
| 問題 |
No.154 市バス
|
| コンテスト | |
| ユーザー |
PicklesSuperior
|
| 提出日時 | 2019-03-14 12:54:01 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,631 bytes |
| コンパイル時間 | 616 ms |
| コンパイル使用メモリ | 62,844 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-26 08:27:37 |
| 合計ジャッジ時間 | 1,427 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | WA * 8 |
ソースコード
#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main(){
int T;
vector<string> bus_memos;
string row;
cin >> T;
for(int i=0;i<T;i++){
cin >> row;
bus_memos.push_back(row);
}
/**
for(int i=0;i<T;i++){
cout<< bus_memos[i] <<endl;
for(int j=0;j<bus_memos[i].size();j++){
cout<< bus_memos[i][j] <<endl;
}
}
**/
for(int i=0;i<T;i++){
int T_memo = bus_memos[i].size();
int white=0,green=0,red=0,bus_count=1;
bool next=false;
bool judge=true;
for(int j=0;j<T_memo;j++){
switch(bus_memos[i][j]){
case 'W':
white+=1;
if(next==true){
bus_count+=1;
next=false;
}
break;
case 'G':
green+=1;
if(next==true){
bus_count+=1;
}else{
next=true;
}
break;
case 'R':
red+=1;
break;
}
if(green<red){
judge=false;
break;
}
}
if(!(red==bus_count) || bus_count>white) judge=false;
cout<< "whit:" << white << " green:" << green << " red:" << red << " bus_c:"<< bus_count << endl;
if(judge){
cout << "possible" << endl;
}else{
cout << "impossible" << endl;
}
}
return 0;
}
PicklesSuperior