結果

問題 No.351 市松スライドパズル
ユーザー TatsunoTatsuno
提出日時 2016-03-12 01:37:15
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 324 ms / 2,000 ms
コード長 1,026 bytes
コンパイル時間 1,296 ms
コンパイル使用メモリ 162,544 KB
実行使用メモリ 10,852 KB
最終ジャッジ日時 2023-10-25 07:24:29
合計ジャッジ時間 5,678 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 232 ms
10,852 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 1 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 1 ms
4,348 KB
testcase_13 AC 315 ms
10,588 KB
testcase_14 AC 316 ms
10,852 KB
testcase_15 AC 323 ms
10,852 KB
testcase_16 AC 322 ms
10,852 KB
testcase_17 AC 317 ms
10,852 KB
testcase_18 AC 316 ms
10,852 KB
testcase_19 AC 323 ms
10,852 KB
testcase_20 AC 324 ms
10,852 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using int64 = int64_t;
#define times(n, i) for (int i = 0; i < n; i++)
#define range(n, m, i) for (int i = n; i < m; i++)
#define upto(n, m, i) for (int i = n; i <= m; i++)
#define downto(n, m, i) for (int i = n; i >= m; i--)
#define foreach(xs, x) for (auto &x : xs)
#define all(xs) (xs).begin(), (xs).end()
#define sortall(xs) sort(all(xs))
#define reverseall(xs) reverse(all(xs))
#define uniqueall(xs) erase(unique(all(xs)), (xs).end())
int64 mod10e9_7 = 1000000007;

int main()
{
    int h, w, n;
    cin >> h >> w >> n;
    char s; int v;
    vector<pair<char, int>> c(n);
    times(n, i) {
        cin >> s >> v;
        c[i].first = s;
        c[i].second = v;
    }
    reverseall(c);
    int y = 0, x = 0;
    times(n, i) {
        if (c[i].first == 'R') {
            if (c[i].second == y)
                x = (x-1+w)%w;
        }
        else if (c[i].second == x)
            y = (y-1+h)%h;
    }
    cout << ((x+y)%2 == 0 ? "white" : "black") << endl;
    return 0;
}
0