挺傻逼的一道题,犯了一些傻逼错误,还写了对拍,拍出了别人的错误。。就是把航线上的每个点对暴力建边,然后跑双关键字最短路即可。。inf要开的够大。。 #include #include ...#define ll long long ...
挺傻逼的一道题,犯了一些傻逼错误,还写了对拍,拍出了别人的错误。。就是把航线上的每个点对暴力建边,然后跑双关键字最短路即可。。inf要开的够大。。 #include #include ...#define ll long long ...
Description Farmer John has recently built an enormous barn consisting of an N×NN×N grid of rooms (2≤N≤100), numbered from (1,1)up to (N,N). Being somewhat afraid of the dark, Bessie the cow ...
感觉自己好颓废呀,暴力建边然后暴力生成树就可以了。 #include #include #include #include #include #include #define maxn 4000010 using namespace std; struct yts { int x,y; long long w;...lo
BZOJ3942 KMP算法
题意: 给一个有向图,然后选一条路径起点终点都为1的路径出来,有一次机会可以沿某条边逆方向走,问最多有多少个点可以被经过?(一个点在路径中无论出现多少次(≥\geq1)对答案的贡献均为1) ...
题意: 从样例讲起。 第一行 s,t,m表示:起点,终点,m条航线。 然后m组,每组第一行len,n表示这条航线的代价, 这类似于公交车,只要用了就花这些钱,但是用多少都这些钱。 注意是单向边。...
线段树+离散化
问题描述约翰有n块草场,编号1到n,这些草场由若干条单行道相连。奶牛贝西是美味牧草的鉴赏家,她想到达尽可能多的草场去品尝牧草。贝西总是从1号草场出发,最后回到1号草场。她想经过尽可能多的草场,贝西在通一个...
AC自动机
→题目链接← 双键值最短路,SPFA 代码: #include #include #include #include #define ll long long #define inf 0X3f3f3f3f3f3f3f3fll using namespace std; struct node{ int to,len1,len2;...v
树上差分板子: #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <algorithm&...#define re...
刷题记录:牛客NC24158[USACO 2015 Jan G]Moovie Mooving
同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...
NKOJ 3213牧草鉴赏家问题描述 约翰有n块草场,编号1到n,这些草场由若干条单行道相连。奶牛贝西是美味牧草的鉴赏家,她想到达尽可能多的草场去品尝牧草。 贝西总是从1号草场出发,最后回到1号草场。...
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 ...
传送门 从前往后直接哈希就完了 #include<bits/stdc++.h> using namespace std; const int RLEN=1<<20|1;...inline char gc(){ static char ibuf[RLEN],*ib,*ob;...(ob=(ib=ibuf)+fread(ibuf,1,...
无论多么艰难,都要继续向前,因为只有你放弃的那一刻,你才输。
题意: 给n个数,然后每次可以选择一对尚存活的数,将其异或和加和到答案中,然后删掉其中一个数,直到只剩一个数为止。 题解: 花样教人理解最小生成树,一片苦心啊,不会最小生成树的可以从这开始理解2333。...
BFS+DP
动态规划思想的运用
SPFA
传送门ber~ 拿栈维护原串 如果AC自动机上跑到一个位置能匹配某个子串,就让top" style="position: relative;" tabindex="0" id="MathJax-Element-7-Frame" class="MathJax">toptoptop减去这个子串的长度 ...
USACO的又一道搜索题 前置芝士 1.BFS(DFS)遍历:用来搜索.(因为BFS好写,本文以BFS为准还不是因为作者懒) 2.链式前向星,本题的数据比较水,所以邻接表也可以写,但是链式前向星它不香吗. 具体做法 对于一个点,它...
【题目链接】 【BZOJ3942题解】的加强版,但是没有什么区别。 /* Pigonometry */ #include #include #include using namespace std;...const int maxn = 1000005, maxq = maxn;...char s[maxn], str[maxn], a
离散化+线段树
[Usaco2015 dec]Max Flow Time Limit: 10 Sec Memory Limit: 128 MB Submit: 576 Solved: 386 Description Farmer John has installed a new system of N−1 pipes to transport milk between the N s...
题目大意题上的中文题意太不明确了。。。 给出一个拓扑图,每条有向边有两个权值,有两个人从1出发到n,分别走这两种权值。问有没有权值使得这两个人都能走过这些权值到达n。思路看懂了题之后就水了。...
线段树 离散化
【BZOJ3939】[Usaco2015 Feb]Cow Hopscotch Description 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 p...
A. Censoring ...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 durin...