随笔分类 - 图/树
摘要:树与图的存储: 前言: 树是一种特殊的图,与图的存储方式相同。对于无向图中的边ab,存储两条有向边a->b, b->a。因此我们可以只考虑有向图的存储。 图/树的两种表示方法: (1) 邻接矩阵: g[a][b] 存储边a->b g[a][b]可以表示边的权重 (2) 邻接表: 邻接表 // 对于每
阅读全文
摘要:G - Curling 2.0 On Planet MM-21, after their Olympic games this year, curling is getting popular. But the rules are somewhat different from ours. The
阅读全文