結果

問題 No.351 市松スライドパズル
ユーザー kk
提出日時 2020-08-26 10:58:51
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 104 ms / 2,000 ms
コード長 741 bytes
コンパイル時間 2,283 ms
コンパイル使用メモリ 196,892 KB
実行使用メモリ 8,192 KB
最終ジャッジ日時 2024-04-24 17:11:17
合計ジャッジ時間 5,601 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
8,064 KB
testcase_01 AC 2 ms
5,248 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 100 ms
7,972 KB
testcase_14 AC 101 ms
8,008 KB
testcase_15 AC 103 ms
8,192 KB
testcase_16 AC 104 ms
8,064 KB
testcase_17 AC 99 ms
7,936 KB
testcase_18 AC 98 ms
8,064 KB
testcase_19 AC 103 ms
8,192 KB
testcase_20 AC 102 ms
8,168 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for (int i=(int)(b); i<(int)(e); i++)
#define ALL(x) (x).begin(), (x).end()

const double PI = acos(-1);

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int h, w, n;
  cin >> h >> w >> n;

  vector<char> s(n);
  vector<int> k(n);

  REP (i, n) cin >> s[i] >> k[i];

  int x = 0, y = 0;
  for (int i = n-1; i >= 0; i--) {
    if (s[i] == 'R') {
      if (k[i] == y) {
        if (--x < 0)
          x += w;
      }
    } else {
      if (k[i] == x) {
        if (--y < 0)
          y += h;
      }
    }
  }

  if ((x&1) == (y&1))
    cout << "white" << endl;
  else
    cout << "black" << endl;
  
  return 0;
}
0