結果

問題 No.351 市松スライドパズル
ユーザー abL8ZLsTbFabL8ZLsTbF
提出日時 2016-04-08 22:33:16
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,007 bytes
コンパイル時間 414 ms
コンパイル使用メモリ 55,388 KB
実行使用メモリ 107,808 KB
最終ジャッジ日時 2024-04-14 23:29:32
合計ジャッジ時間 4,990 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 215 ms
13,764 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 1 ms
6,944 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 1 ms
6,944 KB
testcase_05 AC 1 ms
6,944 KB
testcase_06 AC 1 ms
6,944 KB
testcase_07 AC 1 ms
6,940 KB
testcase_08 AC 1 ms
6,944 KB
testcase_09 AC 1 ms
6,944 KB
testcase_10 AC 1 ms
6,940 KB
testcase_11 AC 1 ms
6,944 KB
testcase_12 AC 1 ms
6,944 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
int main(void){
    // Here your code !
    int h, w;
    cin >> h >> w;
    bool isWhite[h][w];
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            isWhite[i][j] = ((i+j)&1) == 0;
        }
    }
    int n;
    cin >> n;
    cin.ignore();
    bool tempC[h], tempR[w];
    for (int i = 0; i < n; i++) {
        char ch;
        int line;
        cin >> ch >> line;
        cin.ignore();
        if (ch == 'C') {
            for (int j = 0; j < h; j++) {
                tempC[j] = isWhite[j][line];
            }
            for (int j = 0; j < h; j++) {
                isWhite[(j+1)%h][line] = tempC[j];
            }
        } else {
            for (int j = 0; j < w; j++) {
                tempR[j] = isWhite[line][j];
            }
            for (int j = 0; j < w; j++) {
                isWhite[line][(j+1)%w] = tempR[j];
            }
        }
    }
    cout << (isWhite[0][0] ? "white" : "black") << endl;
    return 0;
}
0