제출 #41691

#제출 시각아이디문제언어결과실행 시간메모리
41691gabrielsimoesCop and Robber (BOI14_coprobber)C++14
0 / 100
3 ms512 KiB
#include "coprobber.h"
#include <bits/stdc++.h>
using namespace std;

vector<int> g[MAX_N];
int pos = 0, width = 1;

int start(int N, bool A[MAX_N][MAX_N]) {
  for (int i = 0; i < N; i++) {
    for (int k = 0; k < N; k++) {
      if (A[i][k]) {
        g[i].push_back(k);
      }
    }
  }

  while (g[width].size() == 3) width++;
  width++;

  return 0;
}

int nextMove(int R) {
  int copX = pos % width, copY = pos / width;
  int robberX = R % width, robberY = R % width;
  int distX = abs(copX - robberX), distY = abs(copY - robberY);

  if (distX > distY)
    return pos = pos + (robberX < copX ? -1 : 1);
  else if (distY > distX)
    return pos = pos + (robberY < copY ? -1 : 1) * width;
  else
    return pos;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...