結果

問題 No.351 市松スライドパズル
ユーザー nnasennnasen
提出日時 2018-02-24 18:39:17
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 285 ms / 2,000 ms
コード長 728 bytes
コンパイル時間 1,324 ms
コンパイル使用メモリ 164,620 KB
実行使用メモリ 8,432 KB
最終ジャッジ日時 2023-08-05 06:40:31
合計ジャッジ時間 5,504 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 194 ms
8,188 KB
testcase_01 AC 2 ms
5,600 KB
testcase_02 AC 2 ms
5,444 KB
testcase_03 AC 2 ms
5,456 KB
testcase_04 AC 2 ms
5,396 KB
testcase_05 AC 2 ms
5,420 KB
testcase_06 AC 2 ms
5,496 KB
testcase_07 AC 2 ms
5,356 KB
testcase_08 AC 2 ms
5,360 KB
testcase_09 AC 2 ms
5,468 KB
testcase_10 AC 2 ms
5,584 KB
testcase_11 AC 2 ms
5,352 KB
testcase_12 AC 2 ms
5,340 KB
testcase_13 AC 265 ms
8,260 KB
testcase_14 AC 271 ms
8,256 KB
testcase_15 AC 285 ms
8,240 KB
testcase_16 AC 282 ms
8,192 KB
testcase_17 AC 279 ms
8,432 KB
testcase_18 AC 270 ms
8,248 KB
testcase_19 AC 275 ms
8,304 KB
testcase_20 AC 273 ms
8,428 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n) - 1; (i) >= 0; --i)
#define SZ(n) (int)(n).size()
#define ALL(n) (n).begin(), (n).end()
#define MOD LL(1e9 + 7)
#define INF 1000000
using namespace std;
typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PI;

char c[1000001];
int l[1000001];

int main() {
	int h, w, n;
	cin >> h >> w >> n;
	REP(i, n)
		cin >> c[i] >> l[i];
	int x = 0;
	int y = 0;
	RREP(i, n) {
		if (c[i] == 'R' && l[i] == y)
			x = (x + w - 1) % w;
		else if(c[i] == 'C' && l[i] == x)
			y = (y + h - 1) % h;
	}
	if ((x + y) % 2)
		cout << "black" << endl;
	else
		cout << "white" << endl;
	return 0;
}
0