結果

問題 No.351 市松スライドパズル
ユーザー kongarishisyamokongarishisyamo
提出日時 2016-05-20 15:34:59
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 513 bytes
コンパイル時間 462 ms
コンパイル使用メモリ 54,776 KB
実行使用メモリ 8,320 KB
最終ジャッジ日時 2024-04-16 01:49:42
合計ジャッジ時間 5,178 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 219 ms
8,192 KB
testcase_01 AC 5 ms
8,192 KB
testcase_02 AC 5 ms
8,192 KB
testcase_03 AC 5 ms
8,064 KB
testcase_04 AC 5 ms
8,064 KB
testcase_05 AC 5 ms
8,192 KB
testcase_06 AC 5 ms
8,064 KB
testcase_07 AC 5 ms
8,320 KB
testcase_08 AC 5 ms
8,320 KB
testcase_09 AC 5 ms
8,192 KB
testcase_10 AC 5 ms
8,192 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 390 ms
8,192 KB
testcase_16 AC 393 ms
8,192 KB
testcase_17 AC 312 ms
8,064 KB
testcase_18 AC 386 ms
8,320 KB
testcase_19 AC 394 ms
8,320 KB
testcase_20 AC 388 ms
8,064 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]==y){
			x--;
			if(x==-1) x=W-1;
		}
		else if(S[i]=='R'&&K[i]==x){
			y--;
	}

			if(y==-1) y=H-1;
		}
	int a=0;
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			if(i==y&&j==x){
				cout<<((a==0)?"white":"black")<<endl;
				return 0;
			}
			a=1-a;
		}
	}
}
0