# BZOJ 4801: [Lydsy2017年4月月赛]打牌（枚举）

## Description

，D表示方块），每种花色有A,K,Q,J,10,9,8,7,6,5,4,3,2这么多张牌，其中A是最大的，2是最小的。游戏的第一

2
AH 2S
3C 4D
2H 5S
3C 4D

-3
1

# BZOJ 4144: [AMPPZ2014]Petrol（多源最短路+离线并查集）

## Description

q次询问，每次给出x,y,b，表示出发点是x，终点是y，油量上限为b，且保证x点和y点都是加油站，请回答能否从x走到y。

6 4 5
1 5 2 6
1 3 1
2 3 2
3 4 3
4 5 5
6 4 5
4
1 2 4
2 6 9
1 5 9
6 5 8

TAK
TAK
TAK
NIE

# BZOJ 3943: [Usaco2015 Feb]SuperBull（最大生成树）

## Description

Bessie and her friends are playing hoofball in the annual Superbull championship, and Farmer John is
in charge of making the tournament as exciting as possible. A total of N (1 <= N <= 2000) teams are
playing in the Superbull. Each team is assigned a distinct integer team ID in the range 1…2^30-1
to distinguish it from the other teams. The Superbull is an elimination tournament — after every ga
me, Farmer John chooses which team to eliminate from the Superbull, and the eliminated team can no l
onger play in any more games. The Superbull ends when only one team remains.Farmer John notices a ve
ry unusual property about the scores in matches! In any game, the combined score of the two teams al
ways ends up being the bitwise exclusive OR (XOR) of the two team IDs. For example, if teams 12 and
20 were to play, then 24 points would be scored in that game, since 01100 XOR 10100 = 11000.Farmer J
ohn believes that the more points are scored in a game, the more exciting the game is. Because of th
is, he wants to choose a series of games to be played such that the total number of points scored in

Xor 20(10100) = 24(11000)。FJ相信比赛的得分越高，比赛就越好看，因此，他希望安排一个比赛顺序，使得所

## Input

The first line contains the single integer N. The following N lines contain the N team IDs.

## Output

Output the maximum possible number of points that can be scored in the Superbull.

4
3
6
9
10

37

## HINT

FJ先让编号为3和编号为9的队伍进行比赛，然后让编号为9的队伍赢得比赛(淘汰编号为6的队伍)，现在

10的队伍留了下来最后让编号为6和编号为10的队伍比赛，让编号为10的队伍赢得比赛。所有比赛的得分和就是：(
3Xor9)+(6Xor9)+(6Xor10)=10+15+12=37