結果
| 問題 |
No.351 市松スライドパズル
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-03-12 01:26:27 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,201 bytes |
| コンパイル時間 | 1,273 ms |
| コンパイル使用メモリ | 163,128 KB |
| 実行使用メモリ | 11,228 KB |
| 最終ジャッジ日時 | 2024-09-25 01:45:35 |
| 合計ジャッジ時間 | 5,551 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 15 WA * 2 |
ソースコード
#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;
vector<int> d(h);
times(h, y) {
d[y] = 0;
for (int i = (y + ((w+1)%2))%2; i < w; i += 2) {
d[y] += 1 << i;
}
}
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 << ((d[y] & (1 << (w-x-1))) == 0 ? "black" : "white") << endl;
return 0;
}