洛谷

薛定谔的AC發表於2024-06-20

題目連結:



思路


程式碼

#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 1e4 + 10;

ll x, y, dx, dy, n;
bool vis[N];
int mp[1010][1010];

struct point {
  int x, y;
  bool operator<(const struct point a) const {
    return abs(x) + abs(y) < abs(a.x) + abs(a.y);
  }
}p[N];

int bfs(int x, int y, int state) {
  int i = 0;
  while (1) {
    int flag = 0;
    for (int j = x - i; i <= x + i; i++) {
      if (j >= 1 && j <= x && mp[j][]) {
        
      } 
    }
    if (flag)
      i++;
    else
      break;
   }
  return 0;
}

void dfs(int x, int res) {
  for (int i = 1; i <= n; i++) {
    if (vis[i] == true)
      continue;
    vis[i] = true;
    ll val = bfs(dx, dy, i);
    dfs(x + 1, res + val);
    bfs();
    vis[i] = false;
  }

  
}

int main() {
  cin >> n >> x >> y >> dx >> dy;

  if (x < dx) {
    swap(x, dx);
  }
  if (y < dy) {
    swap(y, dy);
  }

  x -= dx - 1;
  y -= dy - 1;
  x = 1;
  y = 1;
  
  for (int i = 1; i <= n; i++) {
    cin >> p[i].x >> p[i].y;
  }

  dfs(0);

  return 0;
}