結果

問題 No.351 市松スライドパズル
ユーザー t98slidert98slider
提出日時 2022-08-26 02:50:31
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 336 ms / 2,000 ms
コード長 628 bytes
コンパイル時間 1,773 ms
コンパイル使用メモリ 164,840 KB
実行使用メモリ 11,136 KB
最終ジャッジ日時 2024-04-21 07:53:59
合計ジャッジ時間 6,513 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 219 ms
11,000 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 3 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 3 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 318 ms
10,752 KB
testcase_14 AC 322 ms
10,880 KB
testcase_15 AC 326 ms
11,008 KB
testcase_16 AC 326 ms
11,008 KB
testcase_17 AC 320 ms
11,136 KB
testcase_18 AC 322 ms
11,008 KB
testcase_19 AC 336 ms
10,880 KB
testcase_20 AC 327 ms
11,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
    int h, w, n;
    cin >> h >> w >> n;
    vector<pair<char,int>> a(n);
    for(int i = 0; i < n; i++)cin >> a[i].first >> a[i].second;
    reverse(a.begin(), a.end());
    int y = 0, x = 0;
    for(int i = 0; i < n; i++){
        if(a[i].first == 'R'){
            if(y == a[i].second){
                x--;
                if(x < 0)x += w;
            }
        }else{
            if(x == a[i].second){
                y--;
                if(y < 0)y += h;
            }
        }
    }
    cout << ((y ^ x) & 1 ? "black" : "white") << '\n';
}
0