結果

問題 No.351 市松スライドパズル
ユーザー ldsybldsyb
提出日時 2016-03-12 16:28:48
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 323 ms / 2,000 ms
コード長 379 bytes
コンパイル時間 2,077 ms
コンパイル使用メモリ 55,756 KB
実行使用メモリ 8,332 KB
最終ジャッジ日時 2023-10-25 07:36:02
合計ジャッジ時間 5,589 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 229 ms
8,332 KB
testcase_01 AC 1 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 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 314 ms
8,220 KB
testcase_14 AC 316 ms
8,248 KB
testcase_15 AC 323 ms
8,332 KB
testcase_16 AC 320 ms
8,332 KB
testcase_17 AC 315 ms
8,332 KB
testcase_18 AC 314 ms
8,332 KB
testcase_19 AC 318 ms
8,332 KB
testcase_20 AC 318 ms
8,332 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

int main(){
   int h,w,n,x = 0,y = 0;
   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' && k[i] == y) x = (x + w - 1) % w;
      else if(c[i] == 'C' && k[i] == x) y = (y + h - 1) % h;
   }
   cout << (x + y & 1 ? "black" : "white") << endl;
}
0