結果

問題 No.351 市松スライドパズル
ユーザー fiordfiord
提出日時 2016-03-12 00:24:40
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 423 bytes
コンパイル時間 2,041 ms
コンパイル使用メモリ 162,992 KB
実行使用メモリ 38,256 KB
最終ジャッジ日時 2023-10-25 06:18:40
合計ジャッジ時間 6,272 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 279 ms
38,256 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 1 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 1 ms
4,348 KB
testcase_09 WA -
testcase_10 AC 2 ms
4,348 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 383 ms
38,256 KB
testcase_16 AC 383 ms
38,256 KB
testcase_17 AC 379 ms
38,256 KB
testcase_18 AC 378 ms
38,256 KB
testcase_19 WA -
testcase_20 AC 384 ms
38,256 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
	int h,w;	cin>>h>>w;
	int n;	cin>>n;
	vector<string> s(n);
	vector<int> k(n);
	for(int i=0;i<n;i++)	cin>>s[i]>>k[i];
	int cury=0,curx=0;
	for(int i=n-1;i>=0;i--){
		if(s[i]=="C"&&k[i]==curx){
			cury=(cury+w+1)%w;
		}
		else if(s[i]=="R"&&k[i]==cury){
			curx=(curx+h+1)%h;
		}
	}
	if((curx+cury)%2==0)	cout<<"white"<<endl;
	else 	cout<<"black"<<endl;
	return 0;
}
0