結果

問題 No.351 市松スライドパズル
ユーザー aaaaaaiuaaaaaaiu
提出日時 2019-08-15 01:56:52
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 322 ms / 2,000 ms
コード長 419 bytes
コンパイル時間 2,742 ms
コンパイル使用メモリ 200,404 KB
実行使用メモリ 8,540 KB
最終ジャッジ日時 2023-10-19 18:23:27
合計ジャッジ時間 6,597 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 228 ms
8,540 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 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 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 313 ms
8,428 KB
testcase_14 AC 320 ms
8,456 KB
testcase_15 AC 321 ms
8,536 KB
testcase_16 AC 322 ms
8,540 KB
testcase_17 AC 315 ms
8,540 KB
testcase_18 AC 317 ms
8,540 KB
testcase_19 AC 322 ms
8,540 KB
testcase_20 AC 320 ms
8,540 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    int h,w,n;
    cin>>h>>w>>n;
    char a[n];
    int b[n];
    for (int i=0;i<n;i++) cin>>a[i]>>b[i];
    int r=0;
    int c=0;
    for (int i=n-1;i>=0;i--) {
        if (a[i]=='R'&&b[i]==r) c=(c-1+w)%w;
        else if (a[i]=='C'&&b[i]==c) r=(r-1+h)%h;
    }
    if ((r+c)%2==0) puts("white");
    else puts("black");
    return 0;
}
0