結果

問題 No.351 市松スライドパズル
ユーザー hotpepsihotpepsi
提出日時 2016-03-17 00:34:11
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 629 bytes
コンパイル時間 622 ms
コンパイル使用メモリ 58,140 KB
実行使用メモリ 107,252 KB
最終ジャッジ日時 2024-04-08 16:40:22
合計ジャッジ時間 6,324 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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

using namespace std;

char b[10000][10000];

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