結果

問題 No.351 市松スライドパズル
ユーザー 0w10w1
提出日時 2016-11-28 14:38:30
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 622 bytes
コンパイル時間 1,831 ms
コンパイル使用メモリ 168,588 KB
実行使用メモリ 42,288 KB
最終ジャッジ日時 2023-08-18 08:46:51
合計ジャッジ時間 6,673 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 276 ms
42,220 KB
testcase_01 WA -
testcase_02 AC 2 ms
4,380 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 2 ms
4,376 KB
testcase_06 WA -
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 WA -
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 359 ms
41,212 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 360 ms
42,220 KB
testcase_18 AC 360 ms
42,212 KB
testcase_19 WA -
testcase_20 AC 367 ms
42,148 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;
      x = ( x - 1 + W ) % W;
    } else{
      if( y != v ) continue;
      y = ( y - 1 + H ) % H;
    }
  }
  cout << msg[ ( ( x & 1 ) + ( y & 1 ) ) & 1 ] << endl;
  return 0;
}
0