結果
| 問題 |
No.351 市松スライドパズル
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-03-11 23:14:14 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 318 ms / 2,000 ms |
| コード長 | 654 bytes |
| コンパイル時間 | 465 ms |
| コンパイル使用メモリ | 54,792 KB |
| 実行使用メモリ | 8,300 KB |
| 最終ジャッジ日時 | 2024-09-25 02:34:57 |
| 合計ジャッジ時間 | 4,771 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 17 |
ソースコード
#include<iostream>
using namespace std;
const int BUF = 1000005;
int row, col;
int nRcIdx;
char rc[BUF];
int idx[BUF];
void read() {
cin >> row >> col;
cin >> nRcIdx;
for (int i = 0; i < nRcIdx; ++i) {
cin >> rc[i] >> idx[i];
}
}
void work() {
int r = 0;
int c = 0;
for (int i = nRcIdx - 1; i >= 0; --i) {
if (rc[i] == 'R' && r == idx[i]) {
c = (c + col - 1) % col;
}
else if (rc[i] == 'C' && c == idx[i]) {
r = (r + row - 1) % row;
}
}
cout << ((r + c) % 2 == 0 ? "white" : "black") << endl;
}
int main() {
read();
work();
return 0;
}