結果

問題 No.351 市松スライドパズル
ユーザー femtofemto
提出日時 2016-08-20 18:58:19
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 102 ms / 2,000 ms
コード長 660 bytes
コンパイル時間 674 ms
コンパイル使用メモリ 77,656 KB
実行使用メモリ 8,460 KB
最終ジャッジ日時 2023-10-25 07:48:30
合計ジャッジ時間 2,947 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
8,460 KB
testcase_01 AC 3 ms
5,624 KB
testcase_02 AC 2 ms
5,624 KB
testcase_03 AC 2 ms
5,624 KB
testcase_04 AC 2 ms
5,624 KB
testcase_05 AC 2 ms
5,624 KB
testcase_06 AC 2 ms
5,624 KB
testcase_07 AC 2 ms
5,624 KB
testcase_08 AC 2 ms
5,624 KB
testcase_09 AC 2 ms
5,624 KB
testcase_10 AC 2 ms
5,624 KB
testcase_11 AC 2 ms
5,628 KB
testcase_12 AC 2 ms
5,628 KB
testcase_13 AC 100 ms
8,440 KB
testcase_14 AC 100 ms
8,444 KB
testcase_15 AC 102 ms
8,460 KB
testcase_16 AC 102 ms
8,460 KB
testcase_17 AC 96 ms
8,460 KB
testcase_18 AC 96 ms
8,460 KB
testcase_19 AC 101 ms
8,460 KB
testcase_20 AC 101 ms
8,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <iomanip>
using namespace std;

char S[1000000];
int K[1000000];

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int H, W, N;
	cin >> H >> W >> N;
	for(int i = 0; i < N; i++) {
		cin >> S[i] >> K[i];
	}
	reverse(S, S + N);
	reverse(K, K + N);

	int x = 0, y = 0;
	for(int i = 0; i < N; i++) {
		if(S[i] == 'R') {
			if(K[i] == y) {
				x = (x - 1 + W) % W;
			}
		}
		else {
			if(K[i] == x) {
				y = (y - 1 + H) % H;
			}
		}
	}

	if((x + y) % 2 == 0) {
		cout << "white" << endl;
	}
	else {
		cout << "black" << endl;
	}
}
0