摘要:
A Shortest path of the king 题目大意: 给出$8*8$的棋盘,给定起点和终点,输出从起点到达终点的最短步数以及路径。 思路: 必定会尽可能选择沿着两点连线前进,容易得到这样最多能够行走$max(abs(end[0] - start[0]), abs(end[1] - st 阅读全文
摘要:
Tree Tag 题目大意: 有一棵$n$个点的树,$Alice$和$Bob$起初分别在树上的节点$a$,\(b\)。 他们轮流在树上移动一段距离不超过$da$,$db$的路径。 两点间的路径长度为两点间树上简单路径的边数。 如果$Alice$能在无限次追及中追到$Bob$,则$Alice$赢,否则 阅读全文
摘要:
POJ-1502 #include <bits/stdc++.h> using namespace std; typedef pair<int, int> PI; const int N = 105; const int INF = 0x3f3f3f3f; struct Edge { int to, 阅读全文
摘要:
点分治 POJ-1741 #include <cstdio> #include <algorithm> using namespace std; const int N = 10010; const int INF = 0x3f3f3f3f; int n, k, ans; int head[N], 阅读全文