結果

問題 No.351 市松スライドパズル
ユーザー fiordfiord
提出日時 2016-03-12 00:34:52
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 383 ms / 2,000 ms
コード長 423 bytes
コンパイル時間 2,617 ms
コンパイル使用メモリ 162,932 KB
実行使用メモリ 38,212 KB
最終ジャッジ日時 2023-10-25 07:24:14
合計ジャッジ時間 6,525 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 278 ms
38,212 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 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 1 ms
4,348 KB
testcase_11 AC 1 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 376 ms
37,488 KB
testcase_14 AC 376 ms
37,684 KB
testcase_15 AC 382 ms
38,212 KB
testcase_16 AC 383 ms
38,212 KB
testcase_17 AC 379 ms
38,212 KB
testcase_18 AC 377 ms
38,212 KB
testcase_19 AC 383 ms
38,212 KB
testcase_20 AC 383 ms
38,212 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+h-1)%h;
		}
		else if(s[i]=="R"&&k[i]==cury){
			curx=(curx+w-1)%w;
		}
	}
	if((curx+cury)%2==0)	cout<<"white"<<endl;
	else 	cout<<"black"<<endl;
	return 0;
}
0