結果

問題 No.351 市松スライドパズル
ユーザー nksk38nksk38
提出日時 2017-07-08 11:29:51
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 711 bytes
コンパイル時間 743 ms
コンパイル使用メモリ 73,720 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-16 06:23:19
合計ジャッジ時間 3,913 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 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 2 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 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>

using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;

char s[100010];
int k[100010];

int main()
{
	ll H,W,N;
	cin >> H >> W >> N;

	for (int i = 0; i < N; i++)
		cin >> s[i] >> k[i];
	
	int r = 0, c = 0;
	for (int i =N-1; i >= 0; i--) {
		if (s[i] == 'R' && k[i] == r) {
			c = (c + W - 1) % W;
		}else if(s[i] == 'C' && k[i] == c){
			r = (r + H - 1) % H;
		}
	}
	if ((r + c) % 2 == 0)
		cout << "white" << endl;
	else
		cout << "black" << endl;
	
	return 0;
}
0