結果

問題 No.351 市松スライドパズル
ユーザー dnishdnish
提出日時 2017-05-05 12:42:37
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 315 ms / 2,000 ms
コード長 383 bytes
コンパイル時間 1,499 ms
コンパイル使用メモリ 166,956 KB
実行使用メモリ 8,508 KB
最終ジャッジ日時 2023-10-25 07:52:32
合計ジャッジ時間 5,734 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 224 ms
8,508 KB
testcase_01 AC 2 ms
5,680 KB
testcase_02 AC 2 ms
5,680 KB
testcase_03 AC 2 ms
5,680 KB
testcase_04 AC 2 ms
5,680 KB
testcase_05 AC 2 ms
5,680 KB
testcase_06 AC 2 ms
5,680 KB
testcase_07 AC 2 ms
5,680 KB
testcase_08 AC 2 ms
5,680 KB
testcase_09 AC 2 ms
5,680 KB
testcase_10 AC 2 ms
5,680 KB
testcase_11 AC 2 ms
5,680 KB
testcase_12 AC 3 ms
5,680 KB
testcase_13 AC 307 ms
8,428 KB
testcase_14 AC 309 ms
8,452 KB
testcase_15 AC 313 ms
8,508 KB
testcase_16 AC 315 ms
8,508 KB
testcase_17 AC 309 ms
8,508 KB
testcase_18 AC 310 ms
8,508 KB
testcase_19 AC 315 ms
8,508 KB
testcase_20 AC 312 ms
8,508 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:17:13: warning: 'y' may be used uninitialized [-Wmaybe-uninitialized]
   17 |         p((x+y)%2?"black":"white");
      |             ^
main.cpp:12:15: note: 'y' was declared here
   12 |         int x,y;
      |               ^
main.cpp:17:13: warning: 'x' may be used uninitialized [-Wmaybe-uninitialized]
   17 |         p((x+y)%2?"black":"white");
      |             ^
main.cpp:12:13: note: 'x' was declared here
   12 |         int x,y;
      |             ^

ソースコード

diff #

#include <bits/stdc++.h>
#define REP(i,n,N) for(int i=(n);i<(int)N;i++)
#define p(s) cout<<(s)<<endl
using namespace std;

int main(){
	int H,W,N;
	cin>>H>>W>>N;
	char S[1000010];
	int K[1000010];
	REP(i,0,N) cin>>S[i]>>K[i];
	int x,y;
	for(int i=N-1;i>=0; i--){
		if(S[i]=='R'&&y==K[i]) x=(x+W-1)%W;
		if(S[i]=='C'&&x==K[i]) y=(y+H-1)%H;
	}
	p((x+y)%2?"black":"white");
	return 0;
}
0