結果

問題 No.351 市松スライドパズル
ユーザー ngtkanangtkana
提出日時 2020-03-21 14:05:36
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 105 ms / 2,000 ms
コード長 616 bytes
コンパイル時間 1,993 ms
コンパイル使用メモリ 201,392 KB
実行使用メモリ 18,744 KB
最終ジャッジ日時 2023-08-23 13:02:21
合計ジャッジ時間 6,077 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
18,564 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 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 1 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 104 ms
18,100 KB
testcase_14 AC 103 ms
18,296 KB
testcase_15 AC 105 ms
18,608 KB
testcase_16 AC 105 ms
18,676 KB
testcase_17 AC 100 ms
18,744 KB
testcase_18 AC 101 ms
18,560 KB
testcase_19 AC 103 ms
18,552 KB
testcase_20 AC 104 ms
18,564 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using lint=long long;
int main(){
    std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);
    std::cout.setf(std::ios_base::fixed);std::cout.precision(15);
    lint h,w;std::cin>>h>>w;
    lint q;std::cin>>q;
    lint i=0,j=0;
    std::vector<std::pair<char,lint>>queries(q);
    for(lint i=0;i<q;i++){
        char c;lint x;std::cin>>c>>x;
        queries.at(i)={c,x};
    }
    std::reverse(queries.begin(),queries.end());
    for(auto[c,x]:queries){
        if(c=='R'&&x==i&&--j<0)j+=w;
        if(c=='C'&&x==j&&--i<0)i+=h;
    }
    std::cout<<((i+j)%2?"black":"white")<<'\n';
}
0