結果

問題 No.351 市松スライドパズル
ユーザー finefine
提出日時 2016-03-12 19:22:30
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 103 ms / 2,000 ms
コード長 600 bytes
コンパイル時間 432 ms
コンパイル使用メモリ 55,420 KB
実行使用メモリ 8,352 KB
最終ジャッジ日時 2023-10-25 07:36:26
合計ジャッジ時間 2,743 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
8,352 KB
testcase_01 AC 5 ms
8,348 KB
testcase_02 AC 5 ms
8,348 KB
testcase_03 AC 5 ms
8,348 KB
testcase_04 AC 5 ms
8,348 KB
testcase_05 AC 5 ms
8,348 KB
testcase_06 AC 5 ms
8,348 KB
testcase_07 AC 4 ms
8,348 KB
testcase_08 AC 4 ms
8,348 KB
testcase_09 AC 5 ms
8,348 KB
testcase_10 AC 5 ms
8,348 KB
testcase_11 AC 5 ms
8,352 KB
testcase_12 AC 5 ms
8,352 KB
testcase_13 AC 101 ms
8,352 KB
testcase_14 AC 102 ms
8,352 KB
testcase_15 AC 103 ms
8,352 KB
testcase_16 AC 103 ms
8,352 KB
testcase_17 AC 98 ms
8,352 KB
testcase_18 AC 99 ms
8,352 KB
testcase_19 AC 102 ms
8,352 KB
testcase_20 AC 102 ms
8,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,h,w,k[1000000],a = 0,b = 0;
    char c[1000000];
    cin >> h >> w;
    cin >> n;
    for(int i = 0; i < n; i++) {
        cin >> c[i] >> k[i];
    }
    for(int i = n - 1; i >= 0; i--) {
        if (c[i] == 'R' && k[i] == a) {
            b = (b + w - 1) % w;
        } else if (c[i] == 'C' && k[i] == b) {
            a = (a + h - 1) % h;
        }
    }
    if ((a + b) % 2 == 0) {
        cout << "white" << "\n";
    } else {
        cout << "black" << "\n";
    }
    return 0;
}
0