結果

問題 No.351 市松スライドパズル
ユーザー face4face4
提出日時 2018-05-05 14:26:25
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 810 bytes
コンパイル時間 519 ms
コンパイル使用メモリ 64,512 KB
実行使用メモリ 106,368 KB
最終ジャッジ日時 2024-06-28 01:50:59
合計ジャッジ時間 5,660 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 9 TLE * 1 -- * 7
権限があれば一括ダウンロードができます

ソースコード

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