結果

問題 No.351 市松スライドパズル
ユーザー firiexp
提出日時 2019-03-02 17:57:57
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 933 bytes
コンパイル時間 771 ms
コンパイル使用メモリ 94,292 KB
実行使用メモリ 11,216 KB
最終ジャッジ日時 2024-09-13 20:21:27
合計ジャッジ時間 4,054 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 15 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <limits>

static const int MOD = 1000000007;
using ll = int64_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int h, w, n;
    cin >> h >> w >> n;
    int a = 0, b = 0;
    vector<pair<char,int>> v(n);
    for (int i = 0; i < n; ++i) {
        scanf(" %c %d", &v[i].first, &v[i].second);
    }
    reverse(v.begin(), v.end());
    for (int i = 0; i < n; ++i) {
        int c, d; tie(c, d) = v[i];
        if(c == 'R'){
            if(d == a) {
                b--;
                if(b < 0) b += h;
            }
        }else {
            if(d == b) {
                a--;
                if(a < 0) a += w;
            }
        }
    }
    puts((a+b)%2 ?  "black": "white");
    return 0;
}
0