結果

問題 No.351 市松スライドパズル
ユーザー 🍡yurahuna🍡yurahuna
提出日時 2016-03-11 23:03:56
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 99 ms / 2,000 ms
コード長 909 bytes
コンパイル時間 1,838 ms
コンパイル使用メモリ 158,684 KB
実行使用メモリ 8,372 KB
最終ジャッジ日時 2023-10-25 07:12:42
合計ジャッジ時間 3,627 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
8,372 KB
testcase_01 AC 2 ms
5,540 KB
testcase_02 AC 2 ms
5,540 KB
testcase_03 AC 2 ms
5,540 KB
testcase_04 AC 2 ms
5,540 KB
testcase_05 AC 2 ms
5,540 KB
testcase_06 AC 2 ms
5,540 KB
testcase_07 AC 1 ms
5,540 KB
testcase_08 AC 1 ms
5,540 KB
testcase_09 AC 2 ms
5,540 KB
testcase_10 AC 2 ms
5,540 KB
testcase_11 AC 2 ms
5,544 KB
testcase_12 AC 2 ms
5,544 KB
testcase_13 AC 95 ms
8,356 KB
testcase_14 AC 95 ms
8,360 KB
testcase_15 AC 99 ms
8,372 KB
testcase_16 AC 99 ms
8,372 KB
testcase_17 AC 96 ms
8,372 KB
testcase_18 AC 94 ms
8,372 KB
testcase_19 AC 98 ms
8,372 KB
testcase_20 AC 99 ms
8,372 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<P> vp;
typedef vector<ll> vll;

int H, W;
int N;
char q[1000010];
int a[1000010];

signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);

    cin >> H >> W;
    cin >> N;
    rep(i, N) {
        cin >> q[i] >> a[i];
    }

    int r = 0, c = 0;
    rrep(i, N) {
        if (q[i] == 'R' && a[i] == r) {
            c = (c + W - 1) % W;
        } else if (q[i] == 'C' && a[i] == c) {
            r = (r + H - 1) % H;
        }
    }
    if ((r + c) % 2 == 0) {
        printf("white\n");
    } else {
        printf("black\n");
    }
}
0