結果

問題 No.351 市松スライドパズル
ユーザー nksk38nksk38
提出日時 2017-07-08 10:22:27
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,130 bytes
コンパイル時間 621 ms
コンパイル使用メモリ 74,508 KB
実行使用メモリ 399,616 KB
最終ジャッジ日時 2024-04-16 06:21:56
合計ジャッジ時間 6,594 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 218 ms
10,624 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

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