結果

問題 No.351 市松スライドパズル
ユーザー kapokapo
提出日時 2016-05-16 00:16:30
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,013 bytes
コンパイル時間 789 ms
コンパイル使用メモリ 67,204 KB
実行使用メモリ 399,616 KB
最終ジャッジ日時 2024-04-15 22:16:47
合計ジャッジ時間 6,630 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 216 ms
10,624 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 1 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 <iostream>
#include <vector>
#include <queue>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define pb push_back

void row_r(vector<int> &v, int w)
{
	rep(i, 0, w) v[i] ? v[i]=0 : v[i]=1;
}

void row_s(vector<int> &v, int w)
{
	int i, tmp = v[w - 1];
	for (i = w - 1; i > 0; i--) v[i] = v[i - 1];
	v[0] = tmp;
}

void col_s(vector<vector<int> > &vv, int h, int t)
{
	int i, tmp = vv[h - 1][t];
	for (i = h - 1; i > 0; i--) vv[i][t] = vv[i - 1][t];
	vv[0][t] = tmp;
}

int main(void)
{
	int i, j, h, w, n, k;
	char s;
	cin >> h >> w >> n;

	vector<vector<int> > vv;
	vector<int> v = { 1 };
	rep(i, 1, w) v[i - 1] ? v.pb(0) : v.pb(1);
	vv.pb(v);
	rep(i, 1, h) { row_r(v, w); vv.pb(v); }
	// for (auto i : vv) { for (auto j : i) cout << j << " "; cout << endl; }

	rep(i, 0, n) {
		cin >> s >> k;
		(s == 'R') ? row_s(vv[k], w) : col_s(vv, h, k);
	}
	// for (auto i : vv) { for (auto j : i) cout << j << " "; cout << endl; }

	(vv[0][0]) ? printf("white\n") : printf("black\n");

	return 0;
}
0