結果
問題 | No.38 赤青白ブロック |
ユーザー | 0w1 |
提出日時 | 2016-12-15 19:55:59 |
言語 | C++14 (gcc 13.2.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 339 ms / 5,000 ms |
コード長 | 1,543 bytes |
コンパイル時間 | 1,650 ms |
コンパイル使用メモリ | 169,320 KB |
実行使用メモリ | 4,384 KB |
最終ジャッジ日時 | 2023-08-25 01:21:21 |
合計ジャッジ時間 | 11,728 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 328 ms
4,376 KB |
testcase_01 | AC | 323 ms
4,380 KB |
testcase_02 | AC | 332 ms
4,380 KB |
testcase_03 | AC | 322 ms
4,384 KB |
testcase_04 | AC | 315 ms
4,376 KB |
testcase_05 | AC | 322 ms
4,380 KB |
testcase_06 | AC | 335 ms
4,380 KB |
testcase_07 | AC | 333 ms
4,380 KB |
testcase_08 | AC | 335 ms
4,376 KB |
testcase_09 | AC | 339 ms
4,380 KB |
testcase_10 | AC | 324 ms
4,380 KB |
testcase_11 | AC | 331 ms
4,380 KB |
testcase_12 | AC | 331 ms
4,376 KB |
testcase_13 | AC | 327 ms
4,380 KB |
testcase_14 | AC | 332 ms
4,376 KB |
testcase_15 | AC | 337 ms
4,380 KB |
testcase_16 | AC | 322 ms
4,376 KB |
testcase_17 | AC | 325 ms
4,380 KB |
testcase_18 | AC | 323 ms
4,376 KB |
testcase_19 | AC | 316 ms
4,376 KB |
testcase_20 | AC | 328 ms
4,384 KB |
testcase_21 | AC | 330 ms
4,384 KB |
testcase_22 | AC | 325 ms
4,380 KB |
testcase_23 | AC | 321 ms
4,380 KB |
testcase_24 | AC | 330 ms
4,376 KB |
testcase_25 | AC | 333 ms
4,380 KB |
testcase_26 | AC | 320 ms
4,376 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector< int > vi; typedef vector< vi > vvi; typedef vector< ll > vl; typedef vector< vl > vvl; typedef pair< int, int > pii; typedef vector< pii > vp; typedef vector< double > vd; typedef vector< vd > vvd; typedef vector< string > vs; template< class T1, class T2 > int upmin( T1 &x, T2 v ){ if( x > v ){ x = v; return 1; } return 0; } template< class T1, class T2 > int upmax( T1 &x, T2 v ){ if( x < v ){ x = v; return 1; } return 0; } const int INF = 0x3f3f3f3f; int Kr, Kb; string S; void init(){ cin >> Kr >> Kb; cin >> S; } vi pos; void preprocess(){ for( int i = 0; i < 30; ++i ) if( S[ i ] != 'W' ) pos.emplace_back( i ); int ans = 0; for( int i = 0; i < 1 << 20; ++i ){ vi del( 30 ); for( int j = 0; j < 20; ++j ) if( i & 1 << j ) del[ pos[ j ] ] = 1; string t; for( int j = 0; j < 30; ++j ) if( not del[ j ] ) t += S[ j ]; int ng = 0; for( int j = 0; j < t.size(); ++j ){ if( t[ j ] == 'R' ){ ng |= j - Kr >= 0 and t[ j - Kr ] == 'R'; ng |= j + Kr < t.size() and t[ j + Kr ] == 'R'; } if( t[ j ] == 'B' ){ ng |= j - Kb >= 0 and t[ j - Kb ] == 'B'; ng |= j + Kb < t.size() and t[ j + Kb ] == 'B'; } } if( not ng ) upmax( ans, t.size() ); } cout << ans << endl; } void solve(){ } signed main(){ ios::sync_with_stdio( 0 ); init(); preprocess(); solve(); return 0; }