結果

問題 No.351 市松スライドパズル
ユーザー kongarishisyamokongarishisyamo
提出日時 2016-05-20 16:26:32
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 433 ms / 2,000 ms
コード長 532 bytes
コンパイル時間 558 ms
コンパイル使用メモリ 55,980 KB
実行使用メモリ 8,324 KB
最終ジャッジ日時 2023-10-25 07:46:14
合計ジャッジ時間 5,837 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 219 ms
8,324 KB
testcase_01 AC 5 ms
8,324 KB
testcase_02 AC 5 ms
8,324 KB
testcase_03 AC 5 ms
8,324 KB
testcase_04 AC 5 ms
8,324 KB
testcase_05 AC 5 ms
8,324 KB
testcase_06 AC 5 ms
8,324 KB
testcase_07 AC 5 ms
8,324 KB
testcase_08 AC 5 ms
8,324 KB
testcase_09 AC 5 ms
8,324 KB
testcase_10 AC 5 ms
8,324 KB
testcase_11 AC 5 ms
8,324 KB
testcase_12 AC 5 ms
8,324 KB
testcase_13 AC 427 ms
8,324 KB
testcase_14 AC 428 ms
8,324 KB
testcase_15 AC 432 ms
8,324 KB
testcase_16 AC 433 ms
8,324 KB
testcase_17 AC 426 ms
8,324 KB
testcase_18 AC 314 ms
8,324 KB
testcase_19 AC 430 ms
8,324 KB
testcase_20 AC 432 ms
8,324 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>

using namespace std;

#define NMAX 1000008

int main(){

	int H,W;
	int N;
	char S[NMAX];
	int K[NMAX];
	int x=0,y=0;

	cin>>H>>W;
	cin>>N;

	for(int i=0;i<N;i++){
		cin>>S[i]>>K[i];
	}

	for(int i=N-1;i>=0;i--){
		if(S[i]=='C'&&K[i]==x){
			y--;
			if(y==-1) y=H-1;
		}
		else if(S[i]=='R'&&K[i]==y){
			x--;
			if(x==-1) x=W-1;
		}
	}
	int a=0,b=0;
	for(int i=0;i<H;i++){
		a=b;
		for(int j=0;j<W;j++){
			if(i==y&&j==x){
				cout<<((a==0)?"white":"black")<<endl;
				return 0;
			}
			a=1-a;
		}
		b=1-b;
	}
}
0