結果
| 問題 |
No.351 市松スライドパズル
|
| コンテスト | |
| ユーザー |
hotpepsi
|
| 提出日時 | 2016-03-17 00:52:46 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 532 bytes |
| コンパイル時間 | 619 ms |
| コンパイル使用メモリ | 56,668 KB |
| 実行使用メモリ | 11,264 KB |
| 最終ジャッジ日時 | 2024-10-01 08:49:35 |
| 合計ジャッジ時間 | 5,133 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 15 WA * 2 |
ソースコード
#include <iostream>
#include <sstream>
#include <cstring>
using namespace std;
int kind[1000000];
int seq[1000000];
int main(int argc, char *argv[])
{
int H, W, N;
cin >> H >> W >> N;
for (int i = 0; i < N; ++i) {
string S;
cin >> S >> seq[i];
kind[i] = S[0] == 'C';
}
int r = 0, c = 0;
for (int i = N - 1; i >= 0; --i) {
if (kind[i]) {
if (seq[i] == r) {
c = (c + W - 1) % W;
}
} else if (seq[i] == c) {
r = (r + H - 1) % H;
}
}
cout << (((r + c) % 2) ? "black" : "white") << endl;
return 0;
}
hotpepsi