結果

問題 No.351 市松スライドパズル
ユーザー HachimoriHachimori
提出日時 2016-03-11 23:14:14
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 312 ms / 2,000 ms
コード長 654 bytes
コンパイル時間 1,847 ms
コンパイル使用メモリ 55,248 KB
実行使用メモリ 8,324 KB
最終ジャッジ日時 2023-10-25 07:15:23
合計ジャッジ時間 4,672 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 225 ms
8,324 KB
testcase_01 AC 2 ms
5,496 KB
testcase_02 AC 2 ms
5,496 KB
testcase_03 AC 2 ms
5,496 KB
testcase_04 AC 2 ms
5,496 KB
testcase_05 AC 2 ms
5,496 KB
testcase_06 AC 2 ms
5,496 KB
testcase_07 AC 2 ms
5,496 KB
testcase_08 AC 2 ms
5,496 KB
testcase_09 AC 2 ms
5,496 KB
testcase_10 AC 2 ms
5,496 KB
testcase_11 AC 2 ms
5,496 KB
testcase_12 AC 2 ms
5,496 KB
testcase_13 AC 305 ms
8,308 KB
testcase_14 AC 306 ms
8,312 KB
testcase_15 AC 310 ms
8,324 KB
testcase_16 AC 306 ms
8,324 KB
testcase_17 AC 312 ms
8,324 KB
testcase_18 AC 301 ms
8,324 KB
testcase_19 AC 306 ms
8,324 KB
testcase_20 AC 299 ms
8,324 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0