結果

問題 No.351 市松スライドパズル
ユーザー kongarishisyamokongarishisyamo
提出日時 2016-05-20 16:04:16
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 579 bytes
コンパイル時間 467 ms
コンパイル使用メモリ 55,260 KB
実行使用メモリ 8,448 KB
最終ジャッジ日時 2024-04-16 01:51:06
合計ジャッジ時間 21,459 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 WA -
testcase_18 TLE -
testcase_19 TLE -
testcase_20 WA -
権限があれば一括ダウンロードができます

ソースコード

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;
		}
		cout<<S[i]<<","<<K[i]<<"|"<<x<<","<<y<<endl;
	}
	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