結果

問題 No.351 市松スライドパズル
ユーザー __math__math
提出日時 2016-03-11 22:32:58
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 139 ms / 2,000 ms
コード長 675 bytes
コンパイル時間 1,386 ms
コンパイル使用メモリ 163,476 KB
実行使用メモリ 11,756 KB
最終ジャッジ日時 2023-10-25 07:05:45
合計ジャッジ時間 4,193 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
11,756 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 1 ms
4,348 KB
testcase_11 AC 1 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 136 ms
11,756 KB
testcase_14 AC 137 ms
11,756 KB
testcase_15 AC 138 ms
11,756 KB
testcase_16 AC 139 ms
11,756 KB
testcase_17 AC 134 ms
11,756 KB
testcase_18 AC 132 ms
11,756 KB
testcase_19 AC 136 ms
11,756 KB
testcase_20 AC 138 ms
11,756 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:18:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   18 |                 scanf(" %c%d", &s, &k);
      |                 ~~~~~^~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define FOR(i,n) for(int i = 0 ;i < (n); i++) 
#define sz(c) ((int)c.size())
#define ten(n) ((int)1e##n)

typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> Pii;

int main() {
	int h, w, n; cin >> h >> w >> n;
	vector<pair<char,int>> vp;
	FOR(i, n) {
		char s; int k;
		scanf(" %c%d", &s, &k);
		vp.emplace_back(s, k);
	}
	reverse(vp.begin(), vp.end());
	int x = 0, y = 0;
	for (auto& sk : vp) {
		if (sk.first == 'R') {
			if (sk.second == x) y = (y + w - 1) % w;
		} else {
			if (sk.second == y) x = (x + h - 1) % h;
		}
	}

	bool black = (x + y) % 2 == 1;
	puts(black ? "black" : "white");

	return 0;
}
0