結果

問題 No.351 市松スライドパズル
ユーザー ldsybldsyb
提出日時 2016-03-12 15:16:33
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 581 bytes
コンパイル時間 881 ms
コンパイル使用メモリ 56,424 KB
実行使用メモリ 8,392 KB
最終ジャッジ日時 2023-10-25 08:07:04
合計ジャッジ時間 5,157 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 231 ms
8,332 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 WA -
testcase_10 AC 2 ms
4,348 KB
testcase_11 WA -
testcase_12 AC 2 ms
4,348 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 322 ms
8,332 KB
testcase_16 AC 319 ms
8,332 KB
testcase_17 AC 316 ms
8,332 KB
testcase_18 AC 316 ms
8,332 KB
testcase_19 WA -
testcase_20 AC 319 ms
8,332 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

int main(){
   int now = 0,h,w,n;
   cin >> h >> w >> n;
   char c[n];
   int k[n];
   for(int i = 0;i < n;i++)cin >> c[i] >> k[i];
   for(int i = n;i--;){
      if(c[i] == 'R' && now / w == k[i]){
         if(now % w == w - 1) now -= w - 1;
         else now++;
      }else if(c[i] == 'C' && now % w == k[i]){
         if(now / w == h - 1) now %= w;
         else now += w;
      }
   }
   if(now / w & 1) cout << (now - now / w * w & 1 ? "white" : "black") << endl;
   else cout << (now - now / w * w & 1 ? "black" : "white") << endl;
}
0