原题链接: https://vjudge.csgrandeur.cn/problem/POJ-3764
[原题链接](https://vjudge.csgrandeur.cn/problem/POJ-3764)欧拉通路定义:经过图G中每个边恰好一次的路径叫做欧拉通路
欧拉回路定义:若一个回路是欧拉通路,则称之为欧拉回路
题解:
- 由题意得本题仅当无向图为欧拉通路时才可Possible否则Impossible,当图为连通图且无奇度节点或奇度节点为2时,才存在欧拉通路。
-
- 通过并查集确定连通性
- 通过字典树确定每个节点的度
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int N=600010;
const int Z=50;
int trie[N][Z];
int end[N];
int tot=1;
char s1[Z],s2[Z];
int pre[N];
void init(){
memset(end,0,sizeof