結果

問題 No.351 市松スライドパズル
ユーザー simansiman
提出日時 2016-03-27 22:35:07
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,199 bytes
コンパイル時間 767 ms
コンパイル使用メモリ 74,580 KB
実行使用メモリ 400,796 KB
最終ジャッジ日時 2024-04-10 03:58:44
合計ジャッジ時間 5,254 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <limits.h>
#include <time.h>
#include <string>
#include <string.h>
#include <sstream>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <stack>
#include <queue>

using namespace std;

typedef long long ll;

const int WHITE = 0;
const int BLACK = 1;

int main(){
  int h, w;
  cin >> h >> w;
  int n;
  cin >> n;
  int field[h][w];

  int val = WHITE;

  for(int y = 0; y < h; y++){
    int num = val;
    for(int x = 0; x < w; x++){
      field[y][x] = num;
      num ^= 1;
    }
    val ^= 1;
  }

  char s;
  int k;
  for(int i = 0; i < n; i++){
    cin >> s >> k;

    if(s == 'R'){
      int num = field[k][w-1];

      for(int x = w-1; x >= 0; x--){
        if (x != 0){
          field[k][x] = field[k][(x-1)%w];
        }else{
          field[k][x] = num;
        }
      }
    }else{
      int num[h];

      for(int y = 0; y < h; y++){
        num[y] = field[(y+h-1)%h][k];
      }
      for(int y = 0; y < h; y++){
        field[y][k] = num[y];
      }
    }
  }


  if(field[0][0] == WHITE){
    cout << "white" << endl;
  }else{
    cout << "black" << endl;
  }

  return 0;
}
0