結果

問題 No.351 市松スライドパズル
ユーザー btkbtk
提出日時 2016-03-24 02:33:58
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 154 ms / 2,000 ms
コード長 603 bytes
コンパイル時間 2,522 ms
コンパイル使用メモリ 163,608 KB
実行使用メモリ 38,168 KB
最終ジャッジ日時 2023-10-25 07:42:28
合計ジャッジ時間 4,488 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
38,168 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 1 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 151 ms
37,444 KB
testcase_14 AC 150 ms
37,640 KB
testcase_15 AC 154 ms
38,168 KB
testcase_16 AC 154 ms
38,168 KB
testcase_17 AC 146 ms
38,168 KB
testcase_18 AC 149 ms
38,168 KB
testcase_19 AC 152 ms
38,168 KB
testcase_20 AC 151 ms
38,168 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
struct INIT{INIT(){ios::sync_with_stdio(false);cin.tie(0);}}init;

int main() {
    int r=0,c=0,R,C,N;
    cin>>R>>C>>N;
    vector<string> S(N);
    vector<int> K(N);

    for(int i = 0; i < N; i++)cin>>S[i]>>K[i];
    reverse(S.begin(),S.end());
    reverse(K.begin(),K.end());
    for(int i = 0; i < N; i++)
        if(S[i]=="R"){
            if(r==K[i])
                c=(c+C-1)%C;
        }
        else{
            if(c==K[i])
                r=(r+R-1)%R;
        }

    if((r+c)&1)cout<<"black"<<endl;
    else cout<<"white"<<endl;
    return 0;
}
0