ICode9

精准搜索请尝试: 精确搜索
  • CF525D Arthur and Walls2022-08-11 16:01:05

    https://www.luogu.com.cn/problem/CF525D搜索,DFS染色黄色题 思路 贪心+DFSDFS染色,算法其实很好想,考虑哪些*∗点是必须被替换的: 通过观察,我们发现,一个*点要被替换,当且仅当有一个包含它的2×2的矩阵中除它之外全是..点(当我们已经将其他需要替换的*∗点替换掉时) 证明: 当一个*点联

  • 286. Walls and Gates2022-03-09 05:31:06

    The solution of this issue is as same as 542. 01 Matrix class Solution { int m, n; private int[][] dirs ={{-1,0},{1,0},{0,-1},{0,1}}; public void wallsAndGates(int[][] rooms) { if(rooms==null || rooms.length==0) return;

  • 【PDDL语法学习】 了解领域文件(Domain)第一篇2021-12-02 15:30:56

    原文地址:https://planning.wiki/ref/pddl/domain 推荐通过原文了解更多没有翻译到位的内容。 简介 PDDL目前已经是PDDL3.1,不同版本添加了各种语法补充,但绝大部分语法都是PDDL1.2中推出。 PDDL 1.2中的域文件定义了问题的“通用(universal)”方面。本质上,这些方面是不会改变的

  • 286 walls and gate最近的出口2021-06-14 04:01:24

    参考: public void wallsAndGates(int[][] rooms) { for (int i = 0; i < rooms.length; i++) for (int j = 0; j < rooms[0].length; j++) if (rooms[i][j] == 0) dfs(rooms, i, j, 0); } private void dfs(int[][] rooms, int i, int j, int

  • 2021.2.23--vj补题2021-02-23 19:32:46

    B - B  CodeForces - 699B  题目: You are given a description of a depot. It is a rectangular checkered field of n × m size. Each cell in a field can be empty (".") or it can be occupied by a wall ("*"). You have one bomb. If you lay th

  • pygame迷宫游戏,利用pyhton生成迷宫再解迷宫2020-10-16 09:32:53

    0.没图说个*      1.DFS算法和pygame代码: 代码: from maze_gen import * import pygame,sys,time def suwall(x,y): pygame.draw.rect(wind, (0,0,0), (x-(b/2),y,b,k), 0) def hewall(x,y): pygame.draw.rect(wind, (0,0,0), (x,y-(b/2),k,b), 0) def showma

  • [LeetCode] 286. Walls and Gates2020-05-02 10:00:50

    墙与门。题意是给一个二维矩阵,里面的-1代表墙,0代表门,INF代表一个空的房间。请改写所有的INF,表明每个INF到最近的门的距离。例子 Example:  Given the 2D grid: INF -1 0 INF INF INF INF -1 INF -1 INF -1 0 -1 INF INF After running your function, the 2D grid sho

  • Jumping on Walls CodeForces - 199D DFS2020-02-04 18:02:02

    题意: 有两行字符串,X代表不能走,初始时在左上角,一个人走一步后,洪水向右移动一列,小于等于洪水时会被淹没,问能不能走出这两行字符串。有三种走法:向左、向右、跳到另一个字符串的当前位置+k处。 思路: DFS搜索三个走法,看能不能到终点,注意要标记一下走过的点。 代码: #include<iostrea

  • CF525D Arthur and Walls2019-09-10 22:03:36

    洛谷 CF 分析 发现在一个边长为 \(2\) 的联通块中,如果只有一个是*,就必须将其改变,然后 \(bfs\) 找就好了。 代码 #include <queue> #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> #define N 2005 #define il inline #define re register #defin

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有