結果

問題 No.351 市松スライドパズル
ユーザー なおなお
提出日時 2016-04-06 03:26:18
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 353 ms / 2,000 ms
コード長 514 bytes
コンパイル時間 1,768 ms
コンパイル使用メモリ 160,080 KB
実行使用メモリ 8,784 KB
最終ジャッジ日時 2023-10-25 07:44:26
合計ジャッジ時間 6,474 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 261 ms
8,784 KB
testcase_01 AC 2 ms
5,516 KB
testcase_02 AC 2 ms
5,516 KB
testcase_03 AC 2 ms
5,516 KB
testcase_04 AC 2 ms
5,516 KB
testcase_05 AC 2 ms
5,516 KB
testcase_06 AC 2 ms
5,516 KB
testcase_07 AC 2 ms
5,516 KB
testcase_08 AC 2 ms
5,516 KB
testcase_09 AC 2 ms
5,516 KB
testcase_10 AC 2 ms
5,516 KB
testcase_11 AC 2 ms
5,516 KB
testcase_12 AC 2 ms
5,516 KB
testcase_13 AC 343 ms
8,760 KB
testcase_14 AC 346 ms
8,768 KB
testcase_15 AC 350 ms
8,784 KB
testcase_16 AC 350 ms
8,784 KB
testcase_17 AC 345 ms
8,784 KB
testcase_18 AC 348 ms
8,784 KB
testcase_19 AC 353 ms
8,784 KB
testcase_20 AC 352 ms
8,784 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int(i)=0;(i)<(n);++(i))

char S[1111111];
int  K[1111111];

int main(){
    int H, W, N;
    cin >> H >> W >> N;

    string s;
    REP(i,N){
        cin >> s >> K[N-i-1];
        S[N-i-1] = s[0];
    }

    int x = 0, y = 0;
    REP(i,N){
        if(S[i] == 'R'){
            if(y == K[i]) x = (x + W - 1) % W;
        } else {
            if(x == K[i]) y = (y + H - 1) % H;
        }
    }

    cout << ((x+y)%2 ? "black" : "white") << endl;
}
0