結果

問題 No.351 市松スライドパズル
ユーザー hotpepsihotpepsi
提出日時 2016-03-17 00:52:46
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 532 bytes
コンパイル時間 570 ms
コンパイル使用メモリ 58,136 KB
実行使用メモリ 11,104 KB
最終ジャッジ日時 2024-04-08 16:40:35
合計ジャッジ時間 5,172 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 264 ms
11,104 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 2 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 2 ms
6,676 KB
testcase_07 AC 2 ms
6,676 KB
testcase_08 AC 2 ms
6,676 KB
testcase_09 AC 2 ms
6,676 KB
testcase_10 AC 2 ms
6,676 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 344 ms
11,104 KB
testcase_14 AC 350 ms
11,104 KB
testcase_15 AC 356 ms
11,104 KB
testcase_16 AC 355 ms
11,104 KB
testcase_17 AC 348 ms
11,104 KB
testcase_18 AC 350 ms
11,104 KB
testcase_19 AC 356 ms
11,104 KB
testcase_20 AC 353 ms
11,104 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <sstream>
#include <cstring>

using namespace std;

int kind[1000000];
int seq[1000000];

int main(int argc, char *argv[])
{
	int H, W, N;
	cin >> H >> W >> N;
	for (int i = 0; i < N; ++i) {
		string S;
		cin >> S >> seq[i];
		kind[i] = S[0] == 'C';
	}
	int r = 0, c = 0;
	for (int i = N - 1; i >= 0; --i) {
		if (kind[i]) {
			if (seq[i] == r) {
				c = (c + W - 1) % W;
			}
		} else if (seq[i] == c) {
			r = (r + H - 1) % H;
		}
	}
	cout << (((r + c) % 2) ? "black" : "white") << endl;
	return 0;
}
0