結果

問題 No.351 市松スライドパズル
ユーザー imulanimulan
提出日時 2016-03-11 23:19:47
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 131 ms / 2,000 ms
コード長 670 bytes
コンパイル時間 1,381 ms
コンパイル使用メモリ 162,456 KB
実行使用メモリ 11,084 KB
最終ジャッジ日時 2023-10-25 07:17:43
合計ジャッジ時間 3,727 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 111 ms
10,876 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 1 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 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 125 ms
11,084 KB
testcase_14 AC 124 ms
10,876 KB
testcase_15 AC 131 ms
10,876 KB
testcase_16 AC 129 ms
10,876 KB
testcase_17 AC 122 ms
10,876 KB
testcase_18 AC 122 ms
10,876 KB
testcase_19 AC 130 ms
10,876 KB
testcase_20 AC 125 ms
10,876 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:22:23: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   22 |         rep(i,n) scanf(" %c %d",&v[i].fi,&v[i].sc);
      |                  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define rep(i,n) for(i=0;i<n;++i)
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define mp make_pair
#define pb push_back
#define fi first
#define sc second

typedef pair<char,int> p;

int main()
{
	int i;

	int h,w,n;
	cin >>h >>w >>n;

	vector<p> v(n);
	rep(i,n) scanf(" %c %d",&v[i].fi,&v[i].sc);

	int x=0,y=0;
	for(i=n-1; i>=0; --i)
	{
		char s=v[i].fi;
		int k=v[i].sc;

		if(s=='R' && k==x) y=(y+w-1)%w;
		else if(s=='C' && k==y) x=(x+h-1)%h;

		//printf(" %d %d\n",x,y);
	}

	string ans="white";
	if((x+y)%2==1) ans="black";
	std::cout << ans << std::endl;
}
0