P3133 [USACO16JAN]无线电联系Radio Contact 题目描述 Farmer John has lost his favorite cow bell, and Bessie the cow has agreed to help him find it! They both fan out and search the farm along different paths, but stay in contact via radio so they can keep in to…
题目描述 Farmer John has lost his favorite cow bell, and Bessie the cow has agreed to help him find it! They both fan out and search the farm along different paths, but stay in contact via radio so they can keep in touch with each-other. Unfortunately, t…
题目传送门 解题思路: f[i][j]表示FJ走了i步,Bessie走了j步的最小消耗值.方程比较好推. 横纵坐标要搞清楚,因为这东西WA了半小时. AC代码: #include<iostream> #include<cstdio> #include<cmath> using namespace std; ][]; ],y11[],x2[],y2[]; string l,l1; inline long long min(long long a,long long b)…
P3131 [USACO16JAN]子共七Subsequences Summing to Sevens 题目描述 Farmer John's NN cows are standing in a row, as they have a tendency to do from time to time. Each cow is labeled with a distinct integer ID number so FJ can tell them apart. FJ would like to t…
传送门 有趣的前缀和. 数据范围中的n≤200" role="presentation" style="position: relative;">n≤200n≤200提示我需要写出来一个O(n3)" role="presentation" style="position: relative;">O(n3)O(n3)的算法,思来想去感觉前缀和挺靠谱的于是写了写发现只有84,检查后发现把m打成了n(…
无线电联系 Radio Contact 题目描述 Farmer John has lost his favorite cow bell, and Bessie the cow has agreed to help him find it! They both fan out and search the farm along different paths, but stay in contact via radio so they can keep in touch with each-oth…
[洛谷P3135][USACO16JAN]堡哞Fort Moo Bessie和她的朋友Elsie正在建筑一个堡垒,与任何一个好的堡垒一样,这个需要一个强固的框架.Bessie想造一个轮廓是1m宽的空心矩形框架,这样堡垒就可以造在框架上了. Bessie以及选了一个地点建筑堡垒,一片N*M(1<=N,M<=200)的平地.不幸的是,这个地方有一些沼泽地而不可以支撑框架.请帮助Bessie决定最大她可以用堡垒覆盖的区域(即支撑框架的区域),而且避免框架在任何一块沼泽地上. 朴素暴力用前缀和优化成\…
洛谷P4391:https://www.luogu.org/problemnew/show/P4391 思路 对于给定的字符串 运用KMP思想 设P[x]为前x个字符前缀和后缀相同的最长长度 则对于题目中的长度len有: len-p[len]为第一个重复子串的最后一个字符位置 因此len-p[len]即重复子串长度 证明: 因为p[len]为前len个字符中前缀和后缀相同的最长长度 先对于一个重复串来观察 abcd abcd abcd 则对于p[12]=8 就是它后面多出来的重复串 用总长把多出…
P1991 无线通讯网 170通过 539提交 题目提供者洛谷OnlineJudge 标签图论 难度普及+/提高 提交该题 讨论 题解 记录 最新讨论 怎么又炸了 为啥一直40!求解! UKE:invalid input file UKE Invalid Input File 未知错误 编译器不对 题目描述 国防部计划用无线网络连接若干个边防哨所.2 种不同的通讯技术用来搭建无线网络: 每个边防哨所都要配备无线电收发器:有一些哨所还可以增配卫星电话. 任意两个配备了一条卫星电话线路的哨所(两边都…
bzoj炸了,靠离线版题目做了两道(过过样例什么的还是轻松的)但是交不了,正巧洛谷有个"大牛分站",就转回洛谷做题了 水题先行,一道傻逼匈牙利 其实本来的思路是搜索然后发现写出来类似于匈牙利(⊙o⊙) (匈牙利的复杂度惊人,1e6秒过) #include <cstdio> ]; ],fir[],to[],nex[]; int N,n,p,q; void add(int p,int q) { nex[++N]=fir[p];to[N]=q;fir[p]=N; } bool f…