結果

問題 No.351 市松スライドパズル
コンテスト
ユーザー Tawara
提出日時 2016-03-11 23:05:21
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 264 ms / 2,000 ms
コード長 975 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 528 ms
コンパイル使用メモリ 103,432 KB
実行使用メモリ 42,848 KB
最終ジャッジ日時 2026-04-12 06:17:35
合計ジャッジ時間 4,350 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <stdio.h>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cmath>
#include <string>

using namespace std;

typedef vector <int> VI;
typedef vector <VI> VVI;
typedef vector <string> VS;
typedef pair<int,int> PII;
typedef long long LL;
typedef vector <LL> VLL;
typedef unsigned long long ULL;
typedef pair <int, LL> PIL;
typedef vector <PIL> VPIL;

#define range(i,a,b) for(int i=(a); i < (b); i++)
#define rep(i,n) range(i,0,n)

int main(){
	int H,W,N,k,hx=0,hy=0;
	string s;
	vector <string> S;
	vector <int> K;
	scanf("%d %d",&H,&W);
	scanf("%d",&N);
	rep(i,N){
		cin >> s; S.push_back(s);
		cin >> k; K.push_back(k);
	}
	for(int i = N-1; i>=0; i--){
		if (S[i] == "R"){
			if (K[i] == hy) hx = (hx - 1 + W) % W;
		} else {
			if (K[i] == hx) hy = (hy - 1 + H) % H;
		}
	}
	if ((hx + hy) % 2 == 0){
		printf("white\n");
	}else{
		printf("black\n");
	}
	return 0;
}
0