题目链接:hdu_5883_The Best Path 题意: n 个点 m 条无向边的图,找一个欧拉通路/回路使得这个路径所有结点的异或值最大. 题解: 节点 i 的贡献为((du[i] +1/ 2) % 2)* a[i] 如果为欧拉回路,需要枚举一下起点,然后取一下最大 #include<bits/stdc++.h> #define F(i,a,b) for(int i=a;i<=b;i++) using namespace std; ; int t,n,m,du[N],a[N],x…
The Best Path Time Limit: 9000/3000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others) Problem Description Alice is planning her travel route in a beautiful valley. In this valley, there are N lakes, and M rivers linking these lakes. Alice…
题意: n 个点 m 条无向边的图,找一个欧拉通路/回路使得这个路径所有结点的异或值最大. 析:由欧拉路性质,奇度点数量为0或2.一个节点被进一次出一次,度减2,产生一次贡献,因此节点 i 的贡献为 i 点的度数除以2然后再模22degreeu⌋ mod 2)∗au.欧拉回路的起点贡献多一次, 欧拉通路的起点和终点贡献也多一次.因此如果是欧拉回路的话枚举一下起点就好了. 但是这个题有坑,就是有孤立点,这些点可以不连通,....被坑死了,就是这一点,到最后也没过...伤心 代码…
The Best Path Time Limit: 9000/3000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 18 Accepted Submission(s): 8 Problem Description Alice is planning her travel route in a beautiful valley. In this valley, there…