結果

問題 No.38 赤青白ブロック
ユーザー cielciel
提出日時 2014-12-02 02:42:44
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 546 bytes
コンパイル時間 436 ms
コンパイル使用メモリ 53,580 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-02 01:00:28
合計ジャッジ時間 4,531 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 89 ms
4,376 KB
testcase_09 WA -
testcase_10 AC 87 ms
4,384 KB
testcase_11 AC 89 ms
4,380 KB
testcase_12 AC 82 ms
4,380 KB
testcase_13 AC 89 ms
4,380 KB
testcase_14 AC 86 ms
4,376 KB
testcase_15 AC 86 ms
4,380 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 87 ms
4,376 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 79 ms
4,380 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
using namespace std;

int main(){
	int Kr,Kb,R=0;
	string s;
	cin>>Kr>>Kb>>s;
	for(int i=0;i<1<<10;i++)for(int j=0;j<1<<10;j++){
		string t;
		int k=0,r=0,b=0;
		for(;k<s.size();k++){
			if(s[k]=='R'&&(i&(1<<r))){
				if(t.size()>=Kr&&s[t.size()-Kr]=='R')break;
				t+='R';
				r++;
			}else if(s[k]=='B'&&(j&(1<<b))){
				if(t.size()>=Kb&&s[t.size()-Kb]=='B')break;
				t+='B';
				b++;
			}else if(s[k]=='W')t+='W';
		}
		if(k==s.size())R=max(R,(int)t.size());
	}
	cout<<R<<endl;
}
0