码迷,mamicode.com
首页 >  
搜索关键字:paths    ( 1380个结果
Codeforces 1010F Xor-Paths 【搜索】【暴力!】
1 #include 2 #include 3 using namespace std; 4 5 long long a[25][25],ans,k,x1[25]; 6 int n,m,mid; 7 8 map mp[25][25]; 9 10 void dfs1(int x,int y,long ... ...
分类:其他好文   时间:2018-07-18 17:23:40    阅读次数:319
[LeetCode] 437. Path Sum III_ Easy tag: DFS
You are given a binary tree in which each node contains an integer value. Find the number of paths that sum to a given value. The path does not need t ...
分类:其他好文   时间:2018-07-18 01:16:00    阅读次数:184
Codeforces#498F. Xor-Paths(折半搜索)
time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output time limit per test 3 seconds time limit ...
分类:其他好文   时间:2018-07-17 16:45:35    阅读次数:238
Codeforces 1006 F - Xor-Paths
F - Xor-Path 思路: 双向搜索dfs 如果普通的搜索复杂度是n 那么双向搜索复杂度是√n 代码: ...
分类:其他好文   时间:2018-07-17 10:44:49    阅读次数:215
Codeforces 1005F Berland and the Shortest Paths 【最短路树】【性质】
其实是一道裸题,如果没学过最短路树的话会比较难做,要想很久想到关键性质才能做出来。 最短路树顾名思义,就是从一个图中生成出来一棵树,使得每个顶点到root的距离是单源最短路。如果有这样的树的话,那可见这样的树是符合题意的。 怎么生成这样的树呢?关键在于记录前驱father,一个距离root最短路是6 ...
分类:其他好文   时间:2018-07-15 23:16:04    阅读次数:391
git fatal: Paths with -a does not make sense.
使用Windows IDEA操作git出现下面这种问题 解决 改为双引号 ...
分类:其他好文   时间:2018-07-15 19:40:48    阅读次数:169
Codeforces 741D. Arpa’s letter-marked tree and Mehrdad’s Dokhtar-kosh paths
Description 以$1$ 为根 的 $n$ 个节点的树,每条边有一个颜色 $x$,求每一个点的子树内的好的路径的最长长度 一条路径被定义为好的当且仅当把所有经过的边的字母经过排列之后可以变成回文 "题面" Solution 理解了一下 $dsu\,on\,tree$,相比普通的启发式,省去了 ...
分类:其他好文   时间:2018-07-15 11:06:54    阅读次数:191
[LeetCode] 257. Binary Tree Paths_ Easy tag: DFS
Given a binary tree, return all root-to-leaf paths. Note: A leaf is a node with no children. Example: 3.2) Recursive 4.. Test cases 1) empty 2) 1 3) ...
分类:其他好文   时间:2018-07-14 00:22:41    阅读次数:149
Redundant Paths POJ - 3177(边—双连通分量)
题意: 在图中加边 看最少能通过加多少条边把 图变成边—双连通分量 解析: 先做一次dfs,不同的连通分量的low是不同的 注意重边 缩点 统计度为1的点 那么需要加的边为(ret+1)/2 ...
分类:其他好文   时间:2018-07-13 13:31:31    阅读次数:123
Codeforces 1005 F - Berland and the Shortest Paths
F - Berland and the Shortest Paths 思路: bfs+dfs 首先,bfs找出1到其他点的最短路径大小dis[i] 然后对于2...n中的每个节点u,找到它所能改变的所有前驱(在保证最短路径不变的情况下),即找到v,使得dis[v] + 1 == dis[u],并把u ...
分类:其他好文   时间:2018-07-10 17:52:54    阅读次数:330
1380条   上一页 1 ... 28 29 30 31 32 ... 138 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!