摘要:
板子: code:(如果编译器为c++11以上的,不要这样 que.push({dx,dis[dx]}) ) struct stu{ int a,b; bool friend operator<(const stu &x,const stu &y){ return x.b>y.b; } }; voi 阅读全文
摘要:
板子: code:(如果编译器为c++11以上的,不要这样 que.push({dx,dis[dx]}) ) struct stu{ int a,b; bool friend operator<(const stu &x,const stu &y){ return x.b>y.b; } }; voi 阅读全文
摘要:
迪杰斯特拉记录路径的办法就是开一个数组, 记录一下该节点的上一个节点是谁最后在递归输出就可以了 例题: B. wzy的大冒险——出发咯QAQ 单点时限: 2.0 sec 内存限制: 512 MB 单点时限: 2.0 sec 内存限制: 512 MB 单点时限: 2.0 sec 内存限制: 512 M 阅读全文
摘要:
Farmer John wants the cows to prepare for the county jumping competition, so Bessie and the gang are practicing jumping over hurdles. They are getting 阅读全文
摘要:
Freddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on another stone. He plans to visit her, but 阅读全文
摘要:
直接上例题: HDU2544 在每年的校赛里,所有进入决赛的同学都会获得一件很漂亮的t-shirt。但是每当我们的工作人员把上百件的衣服从商店运回到赛场的时候,却是非常累的!所以现在他们想要寻找最短的从商店到赛场的路线,你可以帮助他们吗? Input输入包括多组数据。每组数据第一行是两个整数N、M( 阅读全文
摘要:
A rooted tree is a well-known data structure in computer science and engineering. An example is shown below: In the figure, each node is labeled with 阅读全文
摘要:
There are n houses in the village and some bidirectional roads connecting them. Every day peole always like to ask like this "How far is it if I want 阅读全文
摘要:
Language: Default Closest Common Ancestors Time Limit: 2000MS Memory Limit: 10000K Total Submissions: 24653 Accepted: 7648 Description Write a program 阅读全文
摘要:
例题:http://poj.org/problem?id=1986 POJ1986 Distance Queries Language: Default Distance Queries Time Limit: 2000MS Memory Limit: 30000K Total Submission 阅读全文
摘要:
https://www.luogu.org/problemnew/solution/P3379 LCA叫做最短公共祖先,用来求距离树上两个节点最近的公共点; 常用倍增算法: 阅读全文
|