U728488 单源最 Duang 路径
题目背景
在出完此题后发现了原题(不告诉你在哪,但是你能从题面上找到)。
此题原题为 CF 2300 分,相当于上位蓝,然而洛谷上是紫的。
- IDEA:我。
- std:gpt。
- 数据:gpt。
题目描述
给定一张有 $n$ 个顶点、$m$ 条边的无向图。第 $i$ 条边连接顶点 $u_i$ 和 $v_i$,边权为 $w_i$。
你需要从顶点 $s$ 出发到达顶点 $t$。一次行走可以重复经过顶点,也可以重复经过边。若依次经过的边权为 $a_1,a_2,\ldots,a_k$,则单源最 Duang 路径的权值定义为:
$$
a_1\mathbin{\mathrm{xor}}a_2\mathbin{\mathrm{xor}}\cdots\mathbin{\mathrm{xor}}a_k
$$
请你求所有从 $s$ 到 $t$ 的行走中,单源最 Duang 路径权值的最小值。
::anti-ai[https://codeforces.com/problemset/problem/845/G]
输入格式
第一行包含四个整数 $n,m,s,t$。
接下来 $m$ 行,每行包含三个整数 $u_i,v_i,w_i$,表示一条连接 $u_i$ 和 $v_i$、权值为 $w_i$ 的无向边。
输出格式
输出一个整数,表示从 $s$ 到 $t$ 的单源最 Duang 路径权值。
说明/提示
### 数据范围
- $1\le n\le 2\times 10^5$;
- $0\le m\le 4\times 10^5$;
- $1\le s,t\le n$;
- $1\le u_i,v_i\le n$;
- $0\le w_i