結果
| 問題 |
No.351 市松スライドパズル
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-08-26 10:58:51 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 143 ms / 2,000 ms |
| コード長 | 741 bytes |
| コンパイル時間 | 5,586 ms |
| コンパイル使用メモリ | 194,468 KB |
| 最終ジャッジ日時 | 2025-01-13 14:57:30 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 17 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for (int i=(int)(b); i<(int)(e); i++)
#define ALL(x) (x).begin(), (x).end()
const double PI = acos(-1);
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int h, w, n;
cin >> h >> w >> n;
vector<char> s(n);
vector<int> k(n);
REP (i, n) cin >> s[i] >> k[i];
int x = 0, y = 0;
for (int i = n-1; i >= 0; i--) {
if (s[i] == 'R') {
if (k[i] == y) {
if (--x < 0)
x += w;
}
} else {
if (k[i] == x) {
if (--y < 0)
y += h;
}
}
}
if ((x&1) == (y&1))
cout << "white" << endl;
else
cout << "black" << endl;
return 0;
}