結果
| 問題 | No.351 市松スライドパズル |
| コンテスト | |
| ユーザー |
h_noson
|
| 提出日時 | 2016-03-13 11:32:22 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 373 ms / 2,000 ms |
| コード長 | 767 bytes |
| 記録 | |
| コンパイル時間 | 708 ms |
| コンパイル使用メモリ | 59,896 KB |
| 実行使用メモリ | 50,304 KB |
| 最終ジャッジ日時 | 2024-09-25 02:55:05 |
| 合計ジャッジ時間 | 5,226 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 17 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define RREP(i,s,e) for (i = e-1; i >= s; i--)
#define rrep(i,n) RREP(i,0,n)
#define REP(i,s,e) for (i = s; i < e; i++)
#define rep(i,n) REP(i,0,n)
#define INF 1e8
typedef long long ll;
int h, w;
void f(pair<int,int>& p, int n) {
char s;
int k;
cin >> s >> k;
if (n > 0)
f(p,n-1);
if (s == 'R' && k == p.first)
p.second = (p.second + w - 1) % w;
else if (s == 'C' && k == p.second)
p.first = (p.first + h - 1) % h;
}
int main() {
int n;
pair<int,int> p {0,0};
cin >> h >> w >> n;
f(p,n);
if ((p.first + p.second) % 2 == 0)
cout << "white" << endl;
else
cout << "black" << endl;
return 0;
}
h_noson