結果

問題 No.351 市松スライドパズル
ユーザー TawaraTawara
提出日時 2016-03-11 23:05:21
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 388 ms / 2,000 ms
コード長 975 bytes
コンパイル時間 856 ms
コンパイル使用メモリ 78,580 KB
実行使用メモリ 42,652 KB
最終ジャッジ日時 2023-10-25 07:12:53
合計ジャッジ時間 5,845 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 291 ms
42,652 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 1 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 1 ms
4,348 KB
testcase_11 AC 1 ms
4,348 KB
testcase_12 AC 1 ms
4,348 KB
testcase_13 AC 377 ms
42,128 KB
testcase_14 AC 384 ms
42,128 KB
testcase_15 AC 384 ms
42,652 KB
testcase_16 AC 388 ms
42,652 KB
testcase_17 AC 384 ms
42,652 KB
testcase_18 AC 379 ms
42,652 KB
testcase_19 AC 384 ms
42,652 KB
testcase_20 AC 387 ms
42,652 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:33:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   33 |         scanf("%d %d",&H,&W);
      |         ~~~~~^~~~~~~~~~~~~~~
main.cpp:34:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   34 |         scanf("%d",&N);
      |         ~~~~~^~~~~~~~~

ソースコード

diff #

#include <iostream>
#include <stdio.h>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cmath>
#include <string>

using namespace std;

typedef vector <int> VI;
typedef vector <VI> VVI;
typedef vector <string> VS;
typedef pair<int,int> PII;
typedef long long LL;
typedef vector <LL> VLL;
typedef unsigned long long ULL;
typedef pair <int, LL> PIL;
typedef vector <PIL> VPIL;

#define range(i,a,b) for(int i=(a); i < (b); i++)
#define rep(i,n) range(i,0,n)

int main(){
	int H,W,N,k,hx=0,hy=0;
	string s;
	vector <string> S;
	vector <int> K;
	scanf("%d %d",&H,&W);
	scanf("%d",&N);
	rep(i,N){
		cin >> s; S.push_back(s);
		cin >> k; K.push_back(k);
	}
	for(int i = N-1; i>=0; i--){
		if (S[i] == "R"){
			if (K[i] == hy) hx = (hx - 1 + W) % W;
		} else {
			if (K[i] == hx) hy = (hy - 1 + H) % H;
		}
	}
	if ((hx + hy) % 2 == 0){
		printf("white\n");
	}else{
		printf("black\n");
	}
	return 0;
}
0