Code: // luogu-judger-enable-o2 #include<bits/stdc++.h> #define setIO(s) freopen(s".in","r",stdin) #define maxn 4100000 #define ll long long using namespace std; int u[maxn],v[maxn],p[3000],A[maxn]; ll arr[3000],val[maxn]; int n,…
题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=3943 题意: 有n只队伍,每个队伍有一个编号a[i]. 每场比赛有两支队伍参加,然后选一支队伍淘汰.共进行n-1场比赛,然后比赛结束. 若某场比赛是队伍i和j参加,则该场比赛的得分为a[i] xor a[j]. 问最大的总得分. 题解: 每两支队伍(i,j)连一条边,边权为a[i] xor a[j]. 然后求最大生成树即可. AC Code: #include <iostream> #…
[BZOJ3943][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 p…
3943: [Usaco2015 Feb]SuperBull Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 300  Solved: 185 Description Bessie and her friends are playing hoofball in the annual Superbull championship, and Farmer John is  in charge of making the tournament as ex…
[BZOJ3943][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 p…
3940: [Usaco2015 Feb]Censoring Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 367  Solved: 173[Submit][Status][Discuss] Description Farmer John has purchased a subscription to Good Hooveskeeping magazine for his cows, so they have plenty  of materia…
3940: [Usaco2015 Feb]Censoring Time Limit: 10 Sec  Memory Limit: 128 MB Description Farmer John has purchased a subscription to Good Hooveskeeping magazine for his cows, so they have plenty  of material to read while waiting around in the barn during…
3942: [Usaco2015 Feb]Censoring Description Farmer John has purchased a subscription to Good Hooveskeeping magazine for his cows, so they have plenty of material to read while waiting around in the barn during milking sessions. Unfortunately, the late…
题目链接:BZOJ - 3942 题目分析 我们发现,删掉一段 T 之后,被删除的部分前面的一段可能和后面的一段连接起来出现新的 T . 所以我们删掉一段 T 之后应该接着被删除的位置之前的继续向后匹配. 那么我们维护一个栈,一直向后匹配,如果栈顶出现了 T ,就弹出 T 个字符,然后继续从新的栈顶向后匹配就可以了. 匹配使用 KMP 算法. 代码 #include <iostream> #include <cstdio> #include <cstring> #inc…
题目描述 Bessie and her friends are playing hoofball in the annual Superbull championship, and Farmer John isin charge of making the tournament as exciting as possible. A total of N (1 <= N <= 2000) teams areplaying in the Superbull. Each team is assign…