結果

問題 No.351 市松スライドパズル
ユーザー mayoko_
提出日時 2016-03-11 22:55:41
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 102 ms / 2,000 ms
コード長 1,089 bytes
コンパイル時間 650 ms
コンパイル使用メモリ 83,308 KB
実行使用メモリ 8,292 KB
最終ジャッジ日時 2024-09-25 02:30:09
合計ジャッジ時間 2,963 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
//#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
//#include<list>
#include<queue>
#include<deque>
#include<algorithm>
//#include<numeric>
#include<utility>
#include<complex>
//#include<memory>
#include<functional>
#include<cassert>
#include<set>
#include<stack>

const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;

char s[1000100];
int k[1000010];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int H, W;
    cin >> H >> W;
    int N;
    cin >> N;
    int r = 0, c = 0;
    for (int i = 0; i < N; i++) {
        cin >> s[i] >> k[i];
    }
    for (int i = N-1; i >= 0; i--) {
        if (s[i] == 'R') {
            if (k[i] == r) c = (c+W-1)%W;
        } else {
            if (k[i] == c) r = (r+H-1)%H;
        }
    }
    if ((r+c)%2) cout << "black" << endl;
    else cout << "white" << endl;
    return 0;
}
0