結果
問題 | No.38 赤青白ブロック |
ユーザー | srup٩(๑`н´๑)۶ |
提出日時 | 2016-09-29 22:45:34 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 360 ms / 5,000 ms |
コード長 | 1,269 bytes |
コンパイル時間 | 989 ms |
コンパイル使用メモリ | 72,096 KB |
実行使用メモリ | 69,236 KB |
最終ジャッジ日時 | 2023-08-25 01:19:51 |
合計ジャッジ時間 | 11,122 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 345 ms
68,916 KB |
testcase_01 | AC | 323 ms
68,780 KB |
testcase_02 | AC | 318 ms
68,776 KB |
testcase_03 | AC | 330 ms
68,704 KB |
testcase_04 | AC | 327 ms
69,188 KB |
testcase_05 | AC | 357 ms
68,836 KB |
testcase_06 | AC | 327 ms
68,868 KB |
testcase_07 | AC | 328 ms
68,796 KB |
testcase_08 | AC | 360 ms
68,956 KB |
testcase_09 | AC | 339 ms
68,920 KB |
testcase_10 | AC | 352 ms
68,780 KB |
testcase_11 | AC | 351 ms
68,856 KB |
testcase_12 | AC | 334 ms
68,804 KB |
testcase_13 | AC | 358 ms
68,980 KB |
testcase_14 | AC | 334 ms
68,848 KB |
testcase_15 | AC | 352 ms
68,776 KB |
testcase_16 | AC | 313 ms
69,236 KB |
testcase_17 | AC | 329 ms
69,008 KB |
testcase_18 | AC | 356 ms
68,788 KB |
testcase_19 | AC | 324 ms
68,896 KB |
testcase_20 | AC | 336 ms
68,844 KB |
testcase_21 | AC | 318 ms
69,052 KB |
testcase_22 | AC | 339 ms
68,932 KB |
testcase_23 | AC | 344 ms
69,068 KB |
testcase_24 | AC | 321 ms
68,984 KB |
testcase_25 | AC | 354 ms
68,924 KB |
testcase_26 | AC | 335 ms
68,816 KB |
ソースコード
#include <iostream> #include <algorithm> #include <vector> #include <queue> #include <cstdio> #include <cmath> using namespace std; typedef long long ll; #define rep(i,n) for(int i=0;i<(n);i++) const int INF = 1e9; vector<string> v; int main(void){ int kr, kb; cin >> kr >> kb; string s; cin >> s; for (int mask = 0; mask < (1 << 20); ++mask){ string tm = ""; int p = 0;//20bitの位置 for (int i = 0; i < 30; ++i){ if(s[i] == 'W'){ tm += 'W'; }else{ if(mask & (1 << p)) tm += s[i]; p++; } } // cout << tm << endl; v.push_back(tm); } int ans = 0; for(auto u : v){ bool flag = true; for (int i = 0; i < u.size(); ++i){ if(u[i] == 'R'){ int idl = i - kr, idr = i + kr; if(0 <= idl){ if(u[idl] == 'R'){ flag = false; break; } } if(idr < u.size()){ if(u[idr] == 'R'){ flag = false; break; } } }else if(u[i] == 'B'){ int idl = i - kb, idr = i + kb; if(0 <= idl){ if(u[idl] == 'B'){ flag = false; break; } } if(idr < u.size()){ if(u[idr] == 'B'){ flag = false; break; } } } } if(flag){ // cout << u << endl; ans = max(ans, (int)u.size()); } } printf("%d\n", ans); return 0; }