結果

問題 No.351 市松スライドパズル
ユーザー face4face4
提出日時 2018-05-05 14:58:16
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 752 bytes
コンパイル時間 612 ms
コンパイル使用メモリ 70,880 KB
実行使用メモリ 38,104 KB
最終ジャッジ日時 2023-09-10 10:30:07
合計ジャッジ時間 4,048 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 141 ms
36,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 WA -
testcase_14 AC 205 ms
37,452 KB
testcase_15 WA -
testcase_16 AC 209 ms
37,040 KB
testcase_17 AC 204 ms
37,480 KB
testcase_18 AC 201 ms
37,032 KB
testcase_19 AC 207 ms
36,980 KB
testcase_20 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
using namespace std;

int main(){
    int H, W, n, k;
    vector<string> order;
    string sandk;

    scanf("%d %d", &H, &W);
    scanf("%d\n", &n);

    for(int i = 0; i < n; i++){
        getline(cin, sandk);
        order.push_back(sandk);
    }

    int h = 0, w = 0;

    for(vector<string>::reverse_iterator it = order.rbegin(); it != order.rend(); it++){
        string now = *it;
        if(now[0] == 'R' && h == now[2]-'0'){
            w--;
            if(w < 0)   w += W;
        }else if(now[0] == 'C' && w == now[2]-'0'){
            h--;
            if(h < 0)   h += H;
        }
    }

    if((h+w)%2 == 0)    cout << "white" << endl;
    else                cout << "black" << endl;

    return 0;
}
0