結果
問題 | No.38 赤青白ブロック |
ユーザー | fine |
提出日時 | 2017-01-10 00:29:07 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 322 ms / 5,000 ms |
コード長 | 920 bytes |
コンパイル時間 | 1,623 ms |
コンパイル使用メモリ | 169,544 KB |
実行使用メモリ | 4,380 KB |
最終ジャッジ日時 | 2023-08-25 01:21:40 |
合計ジャッジ時間 | 10,877 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 315 ms
4,376 KB |
testcase_01 | AC | 288 ms
4,376 KB |
testcase_02 | AC | 285 ms
4,380 KB |
testcase_03 | AC | 290 ms
4,380 KB |
testcase_04 | AC | 293 ms
4,376 KB |
testcase_05 | AC | 309 ms
4,376 KB |
testcase_06 | AC | 282 ms
4,376 KB |
testcase_07 | AC | 285 ms
4,380 KB |
testcase_08 | AC | 314 ms
4,376 KB |
testcase_09 | AC | 306 ms
4,380 KB |
testcase_10 | AC | 308 ms
4,380 KB |
testcase_11 | AC | 315 ms
4,380 KB |
testcase_12 | AC | 300 ms
4,376 KB |
testcase_13 | AC | 322 ms
4,376 KB |
testcase_14 | AC | 297 ms
4,380 KB |
testcase_15 | AC | 322 ms
4,376 KB |
testcase_16 | AC | 274 ms
4,376 KB |
testcase_17 | AC | 284 ms
4,380 KB |
testcase_18 | AC | 302 ms
4,376 KB |
testcase_19 | AC | 287 ms
4,380 KB |
testcase_20 | AC | 304 ms
4,380 KB |
testcase_21 | AC | 280 ms
4,376 KB |
testcase_22 | AC | 315 ms
4,380 KB |
testcase_23 | AC | 305 ms
4,380 KB |
testcase_24 | AC | 286 ms
4,380 KB |
testcase_25 | AC | 306 ms
4,376 KB |
testcase_26 | AC | 305 ms
4,380 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int kr, kb; string s; cin >> kr >> kb >> s; vector<int> a; for (int i = 0; i < 30; i++) { if (s[i] != 'W') a.push_back(i); } int ans = 0; for (int i = 0; i < (1 << 20); i++) { vector<int> used(30, true); for (int j = 0; j < 20; j++) { if (i & (1 << j)) used[a[j]] = false; } string s1 = ""; for (int j = 0; j < 30; j++) { if (used[j]) s1 += s[j]; } bool flag = true; for (int j = 0; j < s1.length(); j++) { if (s1[j] == 'W') continue; else if (s1[j] == 'R') { if (j + kr >= s1.length()) continue; if (s1[j + kr] == 'R') { flag = false; break; } } else { if (j + kb >= s1.length()) continue; if (s1[j + kb] == 'B') { flag = false; break; } } } if (flag) ans = max(ans, (int)s1.length()); } cout << ans << endl; return 0; }