結果
| 問題 |
No.38 赤青白ブロック
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-02-28 00:08:57 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 493 bytes |
| コンパイル時間 | 526 ms |
| コンパイル使用メモリ | 66,868 KB |
| 実行使用メモリ | 10,144 KB |
| 最終ジャッジ日時 | 2024-10-13 16:07:22 |
| 合計ジャッジ時間 | 13,025 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | TLE * 1 -- * 26 |
コンパイルメッセージ
main.cpp:32:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
32 | main()
| ^~~~
ソースコード
#include<iostream>
#include<vector>
using namespace std;
int Kr,Kb;
string s,now;
int ans;
void dfs(int id)
{
if(id==s.size())
{
if(ans<now.size())ans=now.size();
return;
}
bool ok=false;
if(s[id]=='W')ok=true;
else if(s[id]=='R')
{
if(now.size()<Kr||now[now.size()-Kr]!='R')ok=true;
}
else
{
if(now.size()<Kb||now[now.size()-Kb]!='B')ok=true;
}
if(ok)
{
now+=s[id];
dfs(id+1);
now.pop_back();
}
dfs(id+1);
}
main()
{
cin>>Kr>>Kb>>s;
dfs(0);
cout<<ans<<endl;
}