結果

問題 No.351 市松スライドパズル
ユーザー 0w10w1
提出日時 2016-11-28 14:41:21
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 376 ms / 2,000 ms
コード長 622 bytes
コンパイル時間 1,751 ms
コンパイル使用メモリ 171,036 KB
実行使用メモリ 42,480 KB
最終ジャッジ日時 2023-10-25 07:49:50
合計ジャッジ時間 6,504 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 275 ms
42,480 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 364 ms
41,492 KB
testcase_14 AC 365 ms
41,688 KB
testcase_15 AC 372 ms
42,480 KB
testcase_16 AC 374 ms
42,480 KB
testcase_17 AC 367 ms
42,480 KB
testcase_18 AC 367 ms
42,480 KB
testcase_19 AC 376 ms
42,480 KB
testcase_20 AC 374 ms
42,480 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

const string msg[] = { "white", "black" };

signed main(){
  int H, W; cin >> H >> W;
  int N; cin >> N;
  vector< pair< string, int > > opx( N );
  for( int i = 0; i < N; ++i )
    cin >> opx[ i ].first >> opx[ i ].second;
  int x = 0, y = 0;
  for( int i = N - 1; i >= 0; --i ){
    string op = opx[ i ].first;
    int v = opx[ i ].second;
    if( op[ 0 ] == 'R' ){
      if( x != v ) continue;
      y = ( y - 1 + W ) % W;
    } else{
      if( y != v ) continue;
      x = ( x - 1 + H ) % H;
    }
  }
  cout << msg[ ( ( x & 1 ) + ( y & 1 ) ) & 1 ] << endl;
  return 0;
}
0