結果

問題 No.351 市松スライドパズル
ユーザー はむ吉🐹はむ吉🐹
提出日時 2016-04-17 14:31:35
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 120 ms / 2,000 ms
コード長 583 bytes
コンパイル時間 692 ms
コンパイル使用メモリ 70,340 KB
実行使用メモリ 8,228 KB
最終ジャッジ日時 2023-10-25 07:45:09
合計ジャッジ時間 3,193 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 100 ms
8,228 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 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 117 ms
7,964 KB
testcase_14 AC 119 ms
8,228 KB
testcase_15 AC 120 ms
8,228 KB
testcase_16 AC 120 ms
8,228 KB
testcase_17 AC 116 ms
8,228 KB
testcase_18 AC 115 ms
8,228 KB
testcase_19 AC 119 ms
8,228 KB
testcase_20 AC 119 ms
8,228 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdlib>
#include <ios>
#include <iostream>
#include <vector>


int main() {
	std::cout.tie(nullptr);
	std::ios::sync_with_stdio(false);
	int h, w, n;
	std::cin >> h >> w >> n;
	std::vector<char> s(n);
	std::vector<int> k(n);
	for (auto i = 0; i < n; i++)
	{
		std::cin >> s[i] >> k[i];
	}
	int r = 0, c = 0;
	for (auto i = n - 1; i >= 0; i--) {
		if (s[i] == 'R' && k[i] == r)
		{
			c = (c + w - 1) % w;
		}
		else if (s[i] == 'C' && k[i] == c)
		{
			r = (r + h - 1) % h;
		}
	}
	std::cout << ((r + c) % 2 == 0 ? "white" : "black") << std::endl;

	return EXIT_SUCCESS;
}
0