随笔分类 - 图论--搜索
摘要:传送门 题意:给定n条边,连接编号从1到1e9之间的点,一次操作可以改变一条边连接的一个端点到另一个端点,也就是将第i条边(u,v)变成(u,w),v≠w,问最少次数操作使得这张图的所有边联通,输出操作次数k,以及每次操作的i,v,w。 分析:先将点离散化。假设有n个联通块s1,s2....sn,可
阅读全文
摘要:传送门 题意:给定无向连通图和起点S,每个点有权值,求遍历无向图得到的最大权值和。但是不能走回头路,即如果从U走到V那么下一步不可以从V走到U。 分析:将图分成两种组成,一种是环,一种是链。对于S所在的环,肯定可以遍历这个环回到S。对于其他的环,肯定可以走到这个环中,遍历这个环,然后原路返回。那么最
阅读全文
摘要:We've got a rectangular n × m-cell maze. Each cell is either passable, or is a wall (impassable). A little boy found the maze and cyclically tiled a p
阅读全文
摘要:传送门 The Robotics Olympiad teams were competing in a contest. There was a tree drawn on the floor, consisting of n nodes and n - 1 edges. The nodes are
阅读全文
摘要:Kilani is playing a game with his friends. This game can be represented as a grid of size n×mn×m, where each cell is either empty or blocked, and ever
阅读全文
摘要:A - Lake Counting POJ - 2386 题意:W是水洼,连起来的W算同一个水洼(是九宫格内的连起来) 解题思路:dfs搜索,搜索不到了就继续,每一个dfs都可以搜到一个水坑,简而言之,总的dfs的次数就是水坑的个数(dfs重新调用的dfs不算) #include<iostream>
阅读全文
摘要:A计划 hdu2102 可怜的公主在一次次被魔王掳走一次次被骑士们救回来之后,而今,不幸的她再一次面临生命的考验。魔王已经发出消息说将在T时刻吃掉公主,因为他听信谣言说吃公主的肉也能长生不老。年迈的国王正是心急如焚,告招天下勇士来拯救公主。不过公主早已习以为常,她深信智勇的骑士LJ肯定能将她救出。
阅读全文
摘要:Pots Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 22688 Accepted: 9626 Special Judge Description You are given two pots, having the volu
阅读全文
摘要:迷宫问题 Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 34227 Accepted: 19479 Description 定义一个二维数组: int maze[5][5] = { 0, 1, 0, 0, 0, 0, 1, 0,
阅读全文
摘要:非常可乐 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 23273 Accepted Submission(s): 9485 Problem D
阅读全文
摘要:Joe works in a maze. Unfortunately, portions of the maze have caught on fire, and the owner of the maze neglected to create a fire escape plan. Help J
阅读全文
摘要:Problem 2150 Fire Game Accept: 3772 Submit: 12868Time Limit: 1000 mSec Memory Limit : 32768 KB Accept: 3772 Submit: 12868Time Limit: 1000 mSec Memory
阅读全文
摘要:Prime Path Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 987 Accepted Submission(s): 635 Proble
阅读全文
摘要:Find The Multiple Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 42035 Accepted: 17654 Special Judge Description Given a positive integer
阅读全文
摘要:Dungeon Master Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 48605 Accepted: 18339 Description You are trapped in a 3D dungeon and need t
阅读全文
摘要:Tempter of the Bone Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 148156 Accepted Submission(s)
阅读全文
摘要:In this task Anna and Maria play a game with a very unpleasant rival. Anna and Maria are in the opposite squares of a chessboard (8 × 8): Anna is in t
阅读全文
摘要:逃离迷宫 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 34147 Accepted Submission(s): 8333 Problem D
阅读全文
摘要:Find a way Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 23967 Accepted Submission(s): 7823 Pro
阅读全文
摘要:7 パズル ime limit1000 ms Memory limit131072 kB OSLinux Source3rd PC Koshien, Final 7 パズルは 8 つの正方形のカードとこれらのカードがぴたりと収まる枠で構成されています。それぞれのカードには、互いに区別できるように 0
阅读全文