結果

問題 No.351 市松スライドパズル
ユーザー nksk38nksk38
提出日時 2017-07-08 11:30:26
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 322 ms / 2,000 ms
コード長 712 bytes
コンパイル時間 673 ms
コンパイル使用メモリ 73,728 KB
実行使用メモリ 8,320 KB
最終ジャッジ日時 2024-04-16 06:23:24
合計ジャッジ時間 4,978 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 235 ms
8,192 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 1 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 1 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 312 ms
8,064 KB
testcase_14 AC 314 ms
8,192 KB
testcase_15 AC 322 ms
8,192 KB
testcase_16 AC 318 ms
8,192 KB
testcase_17 AC 317 ms
8,192 KB
testcase_18 AC 316 ms
8,320 KB
testcase_19 AC 319 ms
8,192 KB
testcase_20 AC 318 ms
8,320 KB
権限があれば一括ダウンロードができます

ソースコード

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[1000010];
int k[1000010];

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