NKOJ 3213牧草鉴赏家问题描述 约翰有n块草场,编号1到n,这些草场由若干条单行道相连。奶牛贝西是美味牧草的鉴赏家,她想到达尽可能多的草场去品尝牧草。 贝西总是从1号草场出发,最后回到1号草场。...
NKOJ 3213牧草鉴赏家问题描述 约翰有n块草场,编号1到n,这些草场由若干条单行道相连。奶牛贝西是美味牧草的鉴赏家,她想到达尽可能多的草场去品尝牧草。 贝西总是从1号草场出发,最后回到1号草场。...
AC自动机
传送门ber~ 拿栈维护原串 如果AC自动机上跑到一个位置能匹配某个子串,就让top" style="position: relative;" tabindex="0" id="MathJax-Element-7-Frame" class="MathJax">toptoptop减去这个子串的长度 ...
SPFA
DescriptionFarmer John has installed a new system of N−1 pipes to transport milk between the N stalls in his barn (2≤N≤50,000), conveniently numbered 1…N. Each pipe connects a pair of stalls, and ...
动态规划思想的运用
画廊秀坊霓裳舞,小桥流水叶娉婷
Description Bessie the cow is a huge fan of card games, which is quite surprising, given her lack of opposable thumbs. Unfortunately, none of the other cows in the herd are good opponents....
同3940把kmp改成Ac自动机就可以了,用一个栈维护信息就好了。 #include #include #include #define maxn 100021 using namespace std; int ch[maxn][26],fail[maxn],n,m,tot,top,f[maxn],val[maxn],q[maxn*2],mx...
题目大意异或Prim。思路没开long long WA了一次你敢信?CODE#define _CRT_SECURE_NO_WARNINGS#include #include #include #include #define MAX 2010 #define INF 0x3f3f3f3f using namespac
离散化+线段树
【题目链接】 【BZOJ3942题解】的加强版,但是没有什么区别。 /* Pigonometry */ #include #include #include using namespace std;...const int maxn = 1000005, maxq = maxn;...char s[maxn], str[maxn], a
[题目链接] https://www.lydsy.com/JudgeOnline/problem.php?id=4397 [算法] 树状数组 时间复杂度 : O(QlogN) [代码] #include<bits/stdc++.h> using namespace std;...#defi...
4390: [Usaco2015 dec]Max Flow Time Limit: 10 Sec Memory Limit: 128 MB Submit: 115 Solved: 69 [Submit][Status][Discuss] Description Farmer John has installed a new system of N−1 pipes to ...
题目描述 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....= N <= 20...
我猜的题意(已经AC): 有一个S串和一个T串,长度均小于1,000,0001,000,000,设当前串为U串,然后从前往后枚举S串一个字符一个字符往U串里添加,若U串后缀为T,则去掉这个后缀继续流程。 题解: ...
题意: 从样例讲起。 第一行 s,t,m表示:起点,终点,m条航线。 然后m组,每组第一行len,n表示这条航线的代价, 这类似于公交车,只要用了就花这些钱,但是用多少都这些钱。 注意是单向边。...
题目描述传送门题解和BZOJ3942是差不多的。 搞一个栈,然后边匹配边压栈,匹配不了就跳到失配,匹配成功就暴力弹栈。 需要注意的一点是,弹栈之后要将当前匹配的节点恢复到栈顶元素的位置,然后从下一个元素开始...
Just like humans enjoy playing the game of Hopscotch, Farmer John's cows have invented a variant of the game for themselves to play. Being played by clumsy animals weighing nearly a ton, Cow Hopscot.....
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 ...
题目描述传送门题解首先kmp求出来失配函数,然后暴力匹配。 如果当前位可以匹配,那么将其压入栈中;如果不能匹配,蹦到它的失配开始匹配;如果有一个完整的子串被压入栈中了,暴力将这个子串弹出。...
3942: [Usaco2015 Feb]CensoringTime Limit: 10 Sec Memory Limit: 128 MBSubmit: 718 Solved: 371[Submit][Status][Discuss]DescriptionFarmer John has purchased a subscription to Good Hooveskeeping ...
题意: 给n个数,然后每次可以选择一对尚存活的数,将其异或和加和到答案中,然后删掉其中一个数,直到只剩一个数为止。 题解: 花样教人理解最小生成树,一片苦心啊,不会最小生成树的可以从这开始理解2333。...
广搜 保证不重复进队 然后多搜几遍直到不能更新答案为止 #include #include #include #include #include #include #include #include #include #include #define T 43333 using namespace std;... whi
刷题记录:牛客NC24158[USACO 2015 Jan G]Moovie Mooving
题意比较难理解,就是给你n个点的树,然后给你m个修改操作,每一次修改包括一个点对(x, y),意味着将x到y所有的点权值加一,最后问你整个树上的点权最大是多少。 比较裸的树链剖分了,感谢Haild的讲解。...
题目大意题上的中文题意太不明确了。。。 给出一个拓扑图,每条有向边有两个权值,有两个人从1出发到n,分别走这两种权值。问有没有权值使得这两个人都能走过这些权值到达n。思路看懂了题之后就水了。...
PROBLEM Tired of the cold winter weather on her farm, Bessie the cow plans to fly to a warmer destination for vacation. Unfortunately, she discovers that only one airline, Air Bovinia, is willi...
[USACO 1.2.4] Palindromic Squares 回文平方数 [USACO 1.2.4] Palindromic Squares 回文平方数_哔哩哔哩_bilibili USACO Section 1.3 Wormhole 官方视频题解 USACO Section 1.3 Wormhole 官方视频题解_...
这题也能wa一发真是@#¥%……&* 贪心 如果Bessie最小的比Elsie最小的大 答案加一 否则 用Bessie最小的换掉Elsie最大的 这不是小时候玩的游戏吗 #include #include #include ...#define ll long lon