結果

問題 No.351 市松スライドパズル
ユーザー nksk38
提出日時 2017-07-08 10:22:27
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 1,130 bytes
コンパイル時間 704 ms
コンパイル使用メモリ 74,284 KB
実行使用メモリ 399,488 KB
最終ジャッジ日時 2024-10-06 19:36:24
合計ジャッジ時間 6,196 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 9 TLE * 1 -- * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>

using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;

int rl[10010][10010];

int main()
{
	ll H,W,N;
	cin >> H >> W >> N;

	
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if ((i % 2 != 0 && j % 2 == 0) || (i % 2 == 0 && j % 2 != 0))
				rl[i][j] = 1;
			else
				rl[i][j] = 0;
		}
	}

	for (int i = 0; i < N; i++) {
		char S;
		int K;
		cin >> S >> K;
		if (S == 'R') {
			int pre0 = rl[K][0];
			rl[K][0] = rl[K][W - 1];
			for (int j = 1; j < W; j++) {
				int pre1 = rl[K][j];
					if (pre0)rl[K][j] = 1;
					else rl[K][j] = 0;
					pre0 = pre1;
			}
		}
		else if (S == 'C') {
			int pre0 = rl[0][K];
			rl[0][K] = rl[H - 1][K];
			for (int j = 1; j < H; j++) {
				int pre1 = rl[j][K];
					if (pre0)rl[j][K] = 1;
					else rl[j][K] = 0;
					pre0 = pre1;
			}
		}
	}
	if (rl[0][0])
		cout << "black" << endl;
	else
		cout << "white" << endl;
	return 0;
}
0