結果
問題 |
No.351 市松スライドパズル
|
ユーザー |
![]() |
提出日時 | 2016-03-11 22:44:40 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 643 bytes |
コンパイル時間 | 336 ms |
コンパイル使用メモリ | 53,468 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-25 01:03:06 |
合計ジャッジ時間 | 2,917 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 12 WA * 5 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:18:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 18 | scanf("%d %d", &H, &W); | ~~~~~^~~~~~~~~~~~~~~~~ main.cpp:19:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 19 | scanf("%d", &N); | ~~~~~^~~~~~~~~~ main.cpp:22:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 22 | scanf("%s %d", t, &K[i]); | ~~~~~^~~~~~~~~~~~~~~~~~~
ソースコード
#include <cstdio> #include <cstring> #include <vector> #include <string> #include <stack> #include <queue> #include <algorithm> int H, W; int N; char S[1048576]; int K[1048576]; int main() { // step 1 scanf("%d %d", &H, &W); scanf("%d", &N); for(int i = 0; i < N; ++i) { char t[2]; scanf("%s %d", t, &K[i]); S[i] = t[0]; } // step 2 int r = 0, c = 0; for(int i = N - 1; i >= 0; --i) { if( S[i] == 'R' and r == K[i] ) { c = (c + 1) % W; } if( S[i] == 'C' and c == K[i] ) { r = (r + 1) % H; } } // step 3 printf("%s\n", ((c + r) % 2 == 0 ? "white" : "black")); return 0; }