結果

問題 No.351 市松スライドパズル
ユーザー kimaguremankimagureman
提出日時 2016-03-14 11:18:30
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 319 ms / 2,000 ms
コード長 662 bytes
コンパイル時間 1,426 ms
コンパイル使用メモリ 163,880 KB
実行使用メモリ 10,888 KB
最終ジャッジ日時 2023-10-25 07:41:01
合計ジャッジ時間 5,726 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 227 ms
10,888 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 1 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 1 ms
4,348 KB
testcase_13 AC 311 ms
10,624 KB
testcase_14 AC 312 ms
10,888 KB
testcase_15 AC 318 ms
10,888 KB
testcase_16 AC 319 ms
10,888 KB
testcase_17 AC 314 ms
10,888 KB
testcase_18 AC 313 ms
10,888 KB
testcase_19 AC 319 ms
10,888 KB
testcase_20 AC 319 ms
10,888 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

typedef vector< pair<char, int> > CtrlInp;

int main(int argc, char** argv)
{
	int h, w, n; cin >> h >> w >> n;

	CtrlInp ctrl;
	ctrl.reserve( n );

	for (int ii=0; ii<n; ++ii) {
		char dir;
		int  num;
		cin >> dir >> num;
		ctrl.push_back( make_pair(dir, num) );
	}

	int col=0, row=0;
	CtrlInp::reverse_iterator ritr = ctrl.rbegin();
	for (; ritr!=ctrl.rend(); ++ritr) {
		if ( ritr->first == 'R' && ritr->second == row ) {
			col = (col+w-1) % w;
		}
		else if ( ritr->first == 'C' && ritr->second == col ) {
			row = (row+h-1) % h;
		}
	}

	cout << ((row+col)%2==0 ? "white" : "black") << endl;
	return 0;
}

0