結果

問題 No.351 市松スライドパズル
ユーザー RIGIHRIGIH
提出日時 2017-07-26 01:47:27
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 322 ms / 2,000 ms
コード長 798 bytes
コンパイル時間 528 ms
コンパイル使用メモリ 64,680 KB
実行使用メモリ 8,320 KB
最終ジャッジ日時 2024-04-17 23:41:50
合計ジャッジ時間 5,848 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 220 ms
8,192 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 311 ms
8,064 KB
testcase_14 AC 312 ms
8,104 KB
testcase_15 AC 319 ms
8,312 KB
testcase_16 AC 318 ms
8,320 KB
testcase_17 AC 313 ms
8,192 KB
testcase_18 AC 312 ms
8,192 KB
testcase_19 AC 320 ms
8,192 KB
testcase_20 AC 322 ms
8,192 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <stdio.h>
#include <cstring>
#include <math.h>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define LL long long
#define mass 1000000007
using namespace std;
int keta(int n,int k){return (n/int(pow(10,double(k-1)))) % 10;} //nの下からk桁目


int main(){
	
	int h,w,n;
	cin>>h>>w;
	cin>>n;
	char *s;
	int *k;
	s=new char[n];
	k=new int[n];
	rep(i,n){
		cin>>s[i]>>k[i];
	}
	int h1=0,w1=0;
	for(int i=n-1;i>=0;i--){
		if(s[i]=='R'){
			if(k[i]==h1){
				w1--;
				if(w1==-1){
					w1=w-1;
				}
			}
		}else{
			if(k[i]==w1){
				h1--;
				if(h1==-1){
					h1=h-1;
				}
			}
		}
	}
	if((h1-w1)%2==0){
		cout<<"white"<<endl;
	}else{
		cout<<"black"<<endl;
	}
	return 0;

}
0