結果

問題 No.154 市バス
ユーザー highdhighd
提出日時 2016-08-30 12:05:45
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 708 bytes
コンパイル時間 697 ms
コンパイル使用メモリ 66,876 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-21 09:54:52
合計ジャッジ時間 1,259 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
5,248 KB
testcase_01 AC 24 ms
5,248 KB
testcase_02 AC 24 ms
5,376 KB
testcase_03 AC 24 ms
5,376 KB
testcase_04 WA -
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 24 ms
5,376 KB
testcase_08 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <string>
#include <iostream>
#include <cstdint>
typedef int_fast16_t int16;
int main() {
	int16 n;
	std::cin>>n;
	std::string a;
	std::getline(std::cin,a);
	for(int i=0;i<n;i++){
		bool is_error=false;
		std::string case_;
		std::getline(std::cin,case_);
		int red_num=0;
		int green_num=0;
                for(auto color:case_){
			switch(color){
			case 'R':
				red_num++;
				break;
			case 'G':
				green_num++;
				break;
			}
			if(red_num>green_num){
				is_error=true;
			}
		}
		auto last=case_.rbegin();
		auto last2=last;
		++last2;
		if(*last=='W'||*last2=='W'||red_num!=green_num||is_error){
			std::cout<<"impossible"<<std::endl;
		}else{
			std::cout<<"possible"<<std::endl;
		}
	}
}
0