結果

問題 No.351 市松スライドパズル
ユーザー imulanimulan
提出日時 2016-03-11 23:17:25
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 691 bytes
コンパイル時間 2,015 ms
コンパイル使用メモリ 162,464 KB
実行使用メモリ 11,120 KB
最終ジャッジ日時 2023-10-25 05:56:54
合計ジャッジ時間 6,095 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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)
	{
		printf("%d\n", 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