結果

問題 No.351 市松スライドパズル
ユーザー face4face4
提出日時 2018-05-05 14:26:25
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 810 bytes
コンパイル時間 500 ms
コンパイル使用メモリ 65,500 KB
実行使用メモリ 11,480 KB
最終ジャッジ日時 2023-09-10 10:26:35
合計ジャッジ時間 5,578 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 197 ms
11,480 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,376 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 H, W;
bool map[10000][10000];

void init(){
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            map[i][j] = (i+j)%2 == 0;
        }
    }
}

void row(int r){
    bool tmp = map[r][W-1];
    for(int i = W-1; i >= 1; i--)   map[r][i] = map[r][i-1];
    map[r][0] = tmp;
}

void column(int c){
    bool tmp = map[H-1][c];
    for(int i = H-1; i >= 1; i--)   map[i][c] = map[i-1][c];
    map[0][c] = tmp;
}

int main(){
    cin >> H >> W;
    init();

    int n;
    cin >> n;
    
    char s;
    int k;
    
    while(n-- > 0){
        cin >> s >> k;
        if(s == 'R')        row(k);
        else if(s == 'C')   column(k);
    }

    if(map[0][0])   cout << "white" << endl;
    else            cout << "black" << endl;

    return 0;
}
0