結果

問題 No.351 市松スライドパズル
ユーザー ShibuyapShibuyap
提出日時 2020-07-21 21:41:28
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 290 ms / 2,000 ms
コード長 836 bytes
コンパイル時間 1,951 ms
コンパイル使用メモリ 198,728 KB
実行使用メモリ 8,440 KB
最終ジャッジ日時 2023-08-30 02:19:56
合計ジャッジ時間 6,837 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 194 ms
8,340 KB
testcase_01 AC 1 ms
4,376 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 1 ms
4,376 KB
testcase_06 AC 2 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 1 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 282 ms
8,076 KB
testcase_14 AC 284 ms
8,216 KB
testcase_15 AC 290 ms
8,440 KB
testcase_16 AC 289 ms
8,248 KB
testcase_17 AC 284 ms
8,188 KB
testcase_18 AC 284 ms
8,336 KB
testcase_19 AC 288 ms
8,336 KB
testcase_20 AC 287 ms
8,316 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("white");}else{puts("black");}
#define MAX_N 200005

int main() {
    int h, w;
    cin >> h >> w;
    int n;
    cin >> n;
    char c[n];
    int k[n];
    rep(i,n)cin >> c[i] >> k[i];
    int x = 0, y = 0;
    drep(i,n){
        if(c[i] == 'R' && k[i] == x){
            if(y == 0){
                y = w - 1;
            }else{
                y--;
            }
        }
        if(c[i] == 'C' && k[i] == y){
            if(x == 0){
                x = h - 1;
            }else{
                x--;
            }
        }
    }

    if((x+y)%2==0)yn;
    return 0;
}
 
 
0