結果
問題 | No.351 市松スライドパズル |
ユーザー |
![]() |
提出日時 | 2016-03-12 09:34:00 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 136 ms / 2,000 ms |
コード長 | 499 bytes |
コンパイル時間 | 385 ms |
コンパイル使用メモリ | 22,528 KB |
実行使用メモリ | 7,396 KB |
最終ジャッジ日時 | 2024-09-25 02:51:01 |
合計ジャッジ時間 | 2,701 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 17 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:17:26: warning: format ‘%s’ expects argument of type ‘char*’, but argument 2 has type ‘char (*)[2]’ [-Wformat=] 17 | scanf( "%s%d", S+i, K+i ); | ~^ ~~~ | | | | char* char (*)[2] main.cpp:14:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 14 | scanf( "%d%d%d", &H, &W, &N ); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ main.cpp:17:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 17 | scanf( "%s%d", S+i, K+i ); | ~~~~~^~~~~~~~~~~~~~~~~~~~
ソースコード
#include<cstdio> #define rep(i,a) for(int i=0;i<(a);++i) #define repd(i,a) for(int i=(a);i>=0;--i) const int MAX_H = 10000, MAX_W = 10000, MAX_N = 1000000; int H, W; int N; char S[MAX_N][2]; int K[MAX_N]; int main() { scanf( "%d%d%d", &H, &W, &N ); rep( i, N ) scanf( "%s%d", S+i, K+i ); int x = 0, y = 0; repd( i, N-1 ) { if( *S[i] == 'R' && K[i] == x ) y = (y-1+W) % W; if( *S[i] == 'C' && K[i] == y ) x = (x-1+H) % H; } puts( (x+y)&1 ? "black" : "white" ); return 0; }