Shortest

CF938G Shortest Path Queries

Shortest Path Queries Luogu CF938G 题面翻译 给出一个连通带权无向图,边有边权,要求支持 \(q\) 个操作: \(1\) \(x\) \(y\) \(d\) 在原图中加入一条 \(x\) 到 \(y\) 权值为 \(d\) 的边 \(2\) \(x\) \(y\) ......
Shortest Queries 938G Path 938

[题解] CF1051F The Shortest Statement

The Shortest Statement 给一张 \(n\) 个点 \(m\) 条边的无向连通图,保证 \(m - n \le 20\),\(q\) 次询问求两个点间的最短路。 \(n, m, q \le 10^5\)。 由于边数只比点数多 20,所以如果我们建出这张图的一棵生成树,那么非树边至 ......
题解 Statement Shortest 1051F 1051

[题解]CF938G Shortest Path Queries

Shortest Path Queries 给你一张无向连通图,支持三种操作: 插入一条边 \((u, v, w)\)。 删除一条边。 求 \((u, v)\) 之间的异或最短路。 \(n, m, 1 < 2^{30}\)。 先考虑异或最短路怎么求,这部分和 最大XOR和路径 是一样的。就是把图上的 ......
题解 Shortest Queries 938G Path

Go - Finding the Shortest Path on a Graph

Problem: You want to find the shortest path between two nodes on a weighted graph. Solution: Use Dijkstra’s algorithm to find the shortest path betwee ......
Shortest Finding Graph Path the

CF1051F The Shortest Statement

很经典的题了,不如说这种带有\(m-n\)很小这类限制的题的处理方法基本都如出一辙 由于图连通因此先搞个生成树出来,考虑非树边的数量很少,因此对于每组询问可以先用LCA求出两点间只经过树边的最短距离 考虑每条树边会如何影响答案,其实无非就是会经过这条树边的某个端点罢了,因此我们把非树边的端点都拿出来 ......
Statement Shortest 1051F 1051 The

ABC211D Number of Shortest paths

分析 一道显然的最短路,用 dijkstra 算法。 计算最短路的同时,保存最短路个数,如果与当前最短路相同,最短路个数相加,否则到这个节点的最短路个数为上一个节点的最短路个数。 Accepted Code #include <bits/stdc++.h> using namespace std; ......
Shortest Number paths 211D ABC

[ABC319G] Counting Shortest Paths 题解

题意 给定由 \(N\) 个节点组成的无向完全图 \(G\),并删去 \(M\) 条边,求该图的最短路数量。 (\(2 \le N \le 2 \times 10^5, 0 \le M \le \min\left\{2 \times 10^5, \dfrac{N(N - 1)}{2}\right\} ......
题解 Counting Shortest Paths 319G

[ABC319G] Counting Shortest Paths

[ABC319G] Counting Shortest Paths Atcoder:[ABC319G] Counting Shortest Paths 洛谷:[ABC319G] Counting Shortest Paths Problem 经典问题:求补图的最短路,边权均为 \(1\),并顺带求出 ......
Counting Shortest Paths 319G ABC

CF845G Shortest Path Problem?

[原题链接](https://codeforces.com/problemset/problem/845/G) 不妨先了解几个前置知识/引理: 异或的抵消性质: * $a\oplus a=0$ * $\forall b[b\not= a],a\oplus b\not=0$ * $(a\oplus b ......
Shortest Problem 845G Path 845

杭电多校赛第9场1002 Shortest path

给定一个数字n,每次可以选择一项。 令n = n - 1 令n = n / 2 , if n % 2 == 0 令n = n / 3 , if n % 3 == 0 求最少需要多少步可以让其变成1. 减1操作可以看作是为了除法做准备,连续超过两次减1再除2是不优的,连续超过三次减1再除2也是不优的。 ......
Shortest 1002 path

CF938G Shortest Path Queries 题解

[TOC] # 题目链接 [CF938G](https://www.luogu.com.cn/problem/CF938G "CF938G") 洛谷挂了 只能交CF # 题目分析 本题有以下几个关键点: ## 为什么使用生成树建树 首先 根据 $WC2011$ 我们发现可以使用 $dfs$ 序来保存 ......
题解 Shortest Queries 938G Path

A Randomized Algorithm for Single-Source Shortest Path on Undirected Real-Weighted Graphs 部分翻译

A Randomized Algorithm for Single-Source Shortest Path on Undirected Real-Weighted Graphs Ran Duan , Jiayi Mao , Xinkai Shu , and Longhui Yin 这篇翻译必定有相 ......

Shortest Time(最短时间)

# 题目描述 如图所示,有若干个城市,它们之间有道路连通,可以互相到达,从一个城市到另一个城市时间为1。现在给出起点城市A,终点城市B,和N条道路。问从A到B最短时间。 ![image](https://img2023.cnblogs.com/blog/3105100/202307/3105100- ......
Shortest 时间 Time

Shortest time(最短时间)

这题怎么这么难啊(恼 有若干个城市,它们之间有道路连通,可以互相到达,从一个城市到另一个城市时间为1。现在给出起点城市A,终点城市B,和N条道路。 问从A到B最短时间。 input 第一行A,B,N(A,B,N<=30),B为最大城市标号 接下来N行,每行两个数x,y,表示城市x和城市y有道路相连。 ......
Shortest 时间 time

Shortest Cycle in a Graph

Shortest Cycle in a Graph There is a bi-directional graph with n vertices, where each vertex is labeled from 0 to n - 1. The edges in the graph are re ......
Shortest Cycle Graph in
共15篇  :1/1页 首页上一页1下一页尾页