結果

問題 No.351 市松スライドパズル
ユーザー raven_38_raven_38_
提出日時 2016-03-12 01:44:11
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 394 ms / 2,000 ms
コード長 1,383 bytes
コンパイル時間 792 ms
コンパイル使用メモリ 86,408 KB
実行使用メモリ 44,496 KB
最終ジャッジ日時 2023-10-25 07:24:56
合計ジャッジ時間 5,906 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 297 ms
44,496 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 1 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 1 ms
4,348 KB
testcase_12 AC 1 ms
4,348 KB
testcase_13 AC 389 ms
44,496 KB
testcase_14 AC 387 ms
44,496 KB
testcase_15 AC 391 ms
44,496 KB
testcase_16 AC 394 ms
44,496 KB
testcase_17 AC 390 ms
44,496 KB
testcase_18 AC 387 ms
44,496 KB
testcase_19 AC 390 ms
44,496 KB
testcase_20 AC 390 ms
44,496 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <functional>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define ALL(v) (v).begin(), (v).end()
#define LENGTHOF(x) (sizeof(x) / sizeof(*(x)))
#define AFILL(a, b) fill((int*)a, (int*)(a + LENGTHOF(a)), b)
#define SQ(x) ((x)*(x))
#define Mod(x, mod) (((x)+(mod)%(mod))
#define MP make_pair
#define PB push_back
#define Fi first
#define Se second
#define INF (1<<29)
#define EPS 1e-10
#define MOD 1000000007

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

int H, W;
int N;
vector<pair<string, int> >SK;

int main()
{
  cin >> H >> W;
  cin >> N;
  rep(i, N){
    string s; int k;
    cin >> s >> k;
    SK.push_back(make_pair(s, k));
  }

  int x = 0, y = 0;
  for(int i=N-1;i>=0;i--){
    if(SK[i].first == "C"){
      if(x == SK[i].second){
	y--;
	if(y < 0) y = H-1;
      }
    }else{
      if(y == SK[i].second){
	x--;
	if(x < 0) x = W-1;
      }
    }
  }

  if((x+y)&1) cout << "black\n";
  else cout << "white\n";
  return 0;
}
0