結果

問題 No.351 市松スライドパズル
ユーザー h_nosonh_noson
提出日時 2016-03-13 11:32:22
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 358 ms / 2,000 ms
コード長 767 bytes
コンパイル時間 564 ms
コンパイル使用メモリ 60,768 KB
実行使用メモリ 50,320 KB
最終ジャッジ日時 2023-10-25 07:38:15
合計ジャッジ時間 5,250 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 260 ms
50,320 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 1 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 349 ms
49,256 KB
testcase_14 AC 352 ms
49,528 KB
testcase_15 AC 358 ms
50,300 KB
testcase_16 AC 357 ms
50,320 KB
testcase_17 AC 350 ms
50,320 KB
testcase_18 AC 351 ms
50,320 KB
testcase_19 AC 358 ms
50,320 KB
testcase_20 AC 356 ms
50,320 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

#define RREP(i,s,e) for (i = e-1; i >= s; i--)
#define rrep(i,n) RREP(i,0,n)
#define REP(i,s,e) for (i = s; i < e; i++)
#define rep(i,n) REP(i,0,n)
#define INF 1e8

typedef long long ll;

int h, w;

void f(pair<int,int>& p, int n) {
    char s;
    int k;
    cin >> s >> k;
    if (n > 0)
        f(p,n-1);
    if (s == 'R' && k == p.first)
        p.second = (p.second + w - 1) % w;
    else if (s == 'C' && k == p.second)
        p.first = (p.first + h - 1) % h;
}

int main() {
    int n;
    pair<int,int> p {0,0};
    cin >> h >> w >> n;
    f(p,n);
    if ((p.first + p.second) % 2 == 0)
        cout << "white" << endl;
    else
        cout << "black" << endl;
    return 0;
}
0