結果
| 問題 |
No.351 市松スライドパズル
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-03-12 01:37:15 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 316 ms / 2,000 ms |
| コード長 | 1,026 bytes |
| コンパイル時間 | 1,248 ms |
| コンパイル使用メモリ | 162,300 KB |
| 実行使用メモリ | 11,008 KB |
| 最終ジャッジ日時 | 2024-09-25 02:43:24 |
| 合計ジャッジ時間 | 5,538 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 17 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using int64 = int64_t;
#define times(n, i) for (int i = 0; i < n; i++)
#define range(n, m, i) for (int i = n; i < m; i++)
#define upto(n, m, i) for (int i = n; i <= m; i++)
#define downto(n, m, i) for (int i = n; i >= m; i--)
#define foreach(xs, x) for (auto &x : xs)
#define all(xs) (xs).begin(), (xs).end()
#define sortall(xs) sort(all(xs))
#define reverseall(xs) reverse(all(xs))
#define uniqueall(xs) erase(unique(all(xs)), (xs).end())
int64 mod10e9_7 = 1000000007;
int main()
{
int h, w, n;
cin >> h >> w >> n;
char s; int v;
vector<pair<char, int>> c(n);
times(n, i) {
cin >> s >> v;
c[i].first = s;
c[i].second = v;
}
reverseall(c);
int y = 0, x = 0;
times(n, i) {
if (c[i].first == 'R') {
if (c[i].second == y)
x = (x-1+w)%w;
}
else if (c[i].second == x)
y = (y-1+h)%h;
}
cout << ((x+y)%2 == 0 ? "white" : "black") << endl;
return 0;
}