結果

問題 No.351 市松スライドパズル
ユーザー めうめう🎒めうめう🎒
提出日時 2016-03-11 23:17:31
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 323 ms / 2,000 ms
コード長 928 bytes
コンパイル時間 805 ms
コンパイル使用メモリ 87,392 KB
実行使用メモリ 11,532 KB
最終ジャッジ日時 2023-10-25 07:17:32
合計ジャッジ時間 5,128 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 223 ms
11,532 KB
testcase_01 AC 1 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 1 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 1 ms
4,348 KB
testcase_12 AC 1 ms
4,348 KB
testcase_13 AC 318 ms
11,532 KB
testcase_14 AC 319 ms
11,532 KB
testcase_15 AC 323 ms
11,532 KB
testcase_16 AC 323 ms
11,532 KB
testcase_17 AC 319 ms
11,532 KB
testcase_18 AC 320 ms
11,532 KB
testcase_19 AC 323 ms
11,532 KB
testcase_20 AC 322 ms
11,532 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <iomanip>
using namespace std;

#define ll long long
#define INF (1 << 30)
#define INFLL (1LL << 60)

int main() {
	int h,w,n;
	vector<pair<char,int> > move;
	cin >> h >> w >> n;
	char a;
	int b;
	for(int i = 0;i < n;i++){
		cin >> a >> b;
		move.push_back(make_pair(a,b));
	}
	pair<int,int> now;
	now = make_pair(0,0);
	for(int i = move.size()-1;i >= 0;i--){
		char muki = move[i].first;
		int zahyo = move[i].second;
		int nx = now.first,ny = now.second;
		if(muki == 'R'){
			if(ny == zahyo) nx--;
			if(nx < 0) nx = w-1;
		}else{
			if(nx == zahyo) ny--;
			if(ny < 0) ny = h-1;
		}
		now = make_pair(nx,ny);
	}
	if((now.first + now.second) % 2 == 0) cout << "white" << endl;
	else cout << "black" << endl;
	return 0;
}
0