模板题
文章平均质量分 80
丶先森
这个作者很懒,什么都没留下…
展开
-
数位DP
基础篇数位dp是一种计数用的dp,一般就是要统计一个区间[le,ri]内满足一些条件数的个数。所谓数位dp,字面意思就是在数位上进行dp咯。数位还算是比较好听的名字,数位的含义:一个数有个位、十位、百位、千位......数的每一位就是数位啦!之所以要引入数位的概念完全就是为了dp。数位dp的实质就是换一种暴力枚举的方式,使得新的枚举方式满足dp的性质,然后记忆化就可以了。转载 2018-02-07 17:36:24 · 167 阅读 · 0 评论 -
Codeforces Round #191 (Div. 2) C. Magic Five(数学,逆元取膜模板)
C. Magic Fivetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere is a long plate s containing n digits.原创 2017-07-24 14:37:08 · 217 阅读 · 0 评论 -
Codeforces Round #141 (Div. 2)E. The Road to Berland is Paved With Good Intentions(2-SAT模板题)
E. The Road to Berland is Paved With Good Intentionstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputBerland原创 2017-07-24 14:25:22 · 295 阅读 · 0 评论 -
HDU1846Brave Game(巴什博弈模板题 博弈论)
Brave GameTime Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 11821 Accepted Submission(s): 7962Problem Description十年前读大学的时候,中国每年都要从国原创 2017-05-28 22:47:29 · 452 阅读 · 0 评论 -
POJ1144Network(割边模板题)
NetworkTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 13771 Accepted: 6257DescriptionA Telephone Line Company (TLC) is establishing a new telephone cab原创 2017-05-08 21:07:03 · 849 阅读 · 0 评论 -
CS Academy E.Triplet Min Sum(最近公共祖先 倍增法模板)
Triplet Min SumTime limit: 2500 msMemory limit: 128 MBYou are given a tree with NN nodes. Answer QQ queries of the type:Given three distinct nodes AA, BB, and CC, find the原创 2017-05-26 21:09:13 · 292 阅读 · 0 评论 -
The 14th Zhejiang Provincial Collegiate Programming Contest Sponsored by TuSimple C题What Kind of Fri
What Kind of Friends Are You?Time Limit: 1 Second Memory Limit: 65536 KBJapari Park is a large zoo home to extant species, endangered species, extinct species, cryptids and some legendary原创 2017-04-25 21:15:02 · 507 阅读 · 0 评论 -
CS Academy Round #30 (Div. 2 only) C.Constant Sum(树状数组,区间修改,单点查询模板)
Constant SumTime limit: 1000 msMemory limit: 128 MBYou have an array AA of NN integers. You have to perform QQ operations of two types:Update: given two integers ii and ss, a原创 2017-05-25 20:28:04 · 248 阅读 · 0 评论 -
POJ2186Popular Cows(强连通分量分解模板)
Popular CowsTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 33426 Accepted: 13615DescriptionEvery cow's dream is to become the most popular cow in the h原创 2017-05-05 22:47:45 · 377 阅读 · 0 评论 -
POJ2387Til the Cows Come Home(最短路问题Bellman-Ford解法)
Til the Cows Come HomeTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 52332 Accepted: 17678DescriptionBessie is out in the field and wants to get back t原创 2017-05-02 22:45:08 · 374 阅读 · 0 评论 -
hdu1231最大连续子序列(dp模板最大连续子序列)
最大连续子序列Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 31686 Accepted Submission(s): 14213Problem Description给定K个整数的序列{ N1, N2, .原创 2017-04-16 21:17:59 · 279 阅读 · 0 评论 -
2012-2013 ACM-ICPC, Asia Tokyo Regional Contest F.Never Wait for Weights(带权并查集模板)
题目大意:存在着n个物品,然后有m次操作! x y l表示y比x重l? x y表示询问y比x重多少解题思路:这是一道带权并查集的问题,之前没有触及到,所以这次遇到就补充一下#include #include#include#include#include#include #include #include #include #原创 2017-07-26 21:44:20 · 721 阅读 · 0 评论 -
HDU - 2665 Kth number(划分树模板题)
Kth numberTime Limit: 15000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 12101 Accepted Submission(s): 3692Problem DescriptionGive you a sequen原创 2017-08-20 18:15:06 · 223 阅读 · 0 评论 -
Network of Schools POJ1236(tarjan缩点+强连通分量模板)
Network of SchoolsTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 19564 Accepted: 7705DescriptionA number of schools are connected to a computer network原创 2017-09-13 11:26:57 · 278 阅读 · 0 评论 -
HDU2639 Bone Collector II(01背包变形)
级第42届ACM国际大学生程序设计竞赛全球总决赛Bone Collector IITime Limit: 5000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5490 Accepted Submission(s): 2901原创 2018-02-05 15:17:36 · 139 阅读 · 0 评论 -
HDU - 3966 Aragorn's Story(树链剖分点权模板题)
Aragorn's StoryTime Limit: 10000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 13639 Accepted Submission(s): 3632Problem DescriptionOur protagon原创 2017-10-12 21:01:59 · 243 阅读 · 0 评论 -
Water Tree CodeForces - 343D(dfs序列+线段树 模板)
D. Water Treetime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputMad scientist Mike has constructed a rooted t原创 2017-10-20 21:55:02 · 335 阅读 · 0 评论 -
POJ1273 Drainage Ditches(网络流最大流模板)
Drainage DitchesTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 78164 Accepted: 30497DescriptionEvery time it rains on Farmer John's fields, a pond form原创 2017-09-21 21:54:38 · 240 阅读 · 0 评论 -
The Unique MST POJ - 1679 (次小生成树模板)
The Unique MSTTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 32148 Accepted: 11633DescriptionGiven a connected undirected graph, tell if its minimum sp原创 2017-09-21 21:45:37 · 226 阅读 · 0 评论 -
POJ - 2449 Remmarguts' Date(k短路模板)
Remmarguts' DateTime Limit: 4000MS Memory Limit: 65536KTotal Submissions: 31470 Accepted: 8580Description"Good man never makes girls wait or breaks an appointment原创 2017-09-21 21:24:29 · 254 阅读 · 0 评论 -
A Simple Problem with Integers POJ - 3468 (线段树区间增减,区间查询模板)
A Simple Problem with IntegersTime Limit: 5000MS Memory Limit: 131072KTotal Submissions: 117870 Accepted: 36662Case Time Limit: 2000MSDescriptionYou have N原创 2017-08-31 18:38:43 · 176 阅读 · 0 评论 -
Just a Hook HDU - 1698(线段树区间更换,区间询问模板)
Just a HookTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 35101 Accepted Submission(s): 17147Problem DescriptionIn the game of D原创 2017-08-31 17:35:54 · 190 阅读 · 0 评论 -
I Hate It HDU - 1754(线段树单点修改,区间求最大值模板)
I Hate ItTime Limit: 9000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 82848 Accepted Submission(s): 31840Problem Description很多学校流行一种比较的习惯。老师们很原创 2017-08-30 18:55:24 · 241 阅读 · 0 评论 -
敌兵布阵 HDU - 1166 (线段树单点修改区间求和模板)
敌兵布阵Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 98863 Accepted Submission(s): 41878Problem DescriptionC国的死对头A国这段时间正在进行军事演习,所以原创 2017-08-30 18:12:42 · 241 阅读 · 0 评论 -
POJ2236Wireless Network(并查集模板)
Wireless NetworkTime Limit: 10000MS Memory Limit: 65536KTotal Submissions: 27117 Accepted: 11218DescriptionAn earthquake takes place in Southeast Asia. The ACM (A原创 2017-04-14 21:26:01 · 205 阅读 · 0 评论 -
POJ2395Out of Hay(最小生成树Kruskal模板)
Out of HayTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 16495 Accepted: 6460DescriptionThe cows have run out of hay, a horrible event that must be rem原创 2017-04-14 21:06:12 · 261 阅读 · 0 评论 -
POJ1159Palindrome(区间dp回文串最长公共子序列+滚动数组模板)
PalindromeTime Limit: 3000MS Memory Limit: 65536KTotal Submissions: 62457 Accepted: 21761DescriptionA palindrome is a symmetrical string, that is, a string read i原创 2017-04-05 22:26:29 · 561 阅读 · 0 评论 -
Asteroids(二分图匹配)
Bessie wants to navigate her spaceship through a dangerous asteroid field in the shape of an N x N grid (1 <= N <= 500). The grid contains K asteroids (1 <= K <= 10,000), which are conveniently locate原创 2017-03-10 23:52:55 · 229 阅读 · 0 评论 -
HDU1686(KMP多次匹配)
OulipoTime Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 12783 Accepted Submission(s): 5025Problem DescriptionThe French author Geor原创 2017-03-16 22:34:22 · 438 阅读 · 0 评论 -
POJ - 1195 Mobile phones(二位树状数组模版)
Mobile phonesTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 19323 Accepted: 8917DescriptionSuppose that the fourth generation mobile phone base station原创 2017-03-17 22:56:07 · 172 阅读 · 0 评论 -
The Accomodation of Students(匈牙利算法+二分图染色判别模板)
The Accomodation of StudentsTime Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 6089 Accepted Submission(s): 2771Problem DescriptionT原创 2017-03-17 22:48:26 · 192 阅读 · 0 评论 -
D. Maxim and Array(贪心+优先队列模板)
D. Maxim and Arraytime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputRecently Maxim has found an array of n i原创 2017-03-30 16:18:18 · 448 阅读 · 0 评论 -
POJ3624Charm Bracelet(动态规划(DP)01背包模板)
Charm BraceletTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 38166 Accepted: 16561DescriptionBessie has gone to the mall's jewelry store and spies a ch原创 2017-03-31 21:45:15 · 260 阅读 · 0 评论 -
2015-2016 ACM-ICPC Southwestern Europe Regional Contest (SWERC 15) C题Canvas Painting(单调队列)
题目大意:给你n个长度为ai的数字,要求算出来把他们分成不同颜色需要涂最小数目,涂色的方式是:选择一个颜色C然后选一个数量F,数量F的要求是小于颜色C所拥有的数量,将前F个涂成一种颜色,剩余颜色为C的涂成另外一种颜色解题思路:一般来说,要想让其花费最少,需要尽可能的多改动小的,但是顺着想其实想不出来,应该倒着想,结果是他们都不一样,我现在希望能够把他们变成一样的,这样的话就是一个优先队列的问题原创 2017-03-30 20:48:58 · 701 阅读 · 0 评论 -
POJ2955Brackets(区间DP模板题)
BracketsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 7556 Accepted: 4020DescriptionWe give the following inductive definition of a “regular bracket原创 2017-04-08 16:16:02 · 265 阅读 · 0 评论 -
POJ3660Cow Contest(floyed算法模板)
Cow ContestTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 11015 Accepted: 6128DescriptionN (1 ≤ N ≤ 100) cows, conveniently numbered 1..N, are particip原创 2017-03-27 21:56:56 · 347 阅读 · 0 评论 -
B. Maximal Area Quadrilateral(叉积模板)
B. Maximal Area Quadrilateraltime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputIahub has drawn a set of n poi原创 2017-03-08 23:45:22 · 259 阅读 · 0 评论 -
POJ2352-Stars(树状数组模板)
StarsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 46056 Accepted: 19877DescriptionAstronomers often examine star maps where stars are represented by原创 2017-03-08 23:36:52 · 195 阅读 · 0 评论 -
POJ1985Cow Marathon(求树的直径模板)
Cow MarathonTime Limit: 2000MS Memory Limit: 30000KTotal Submissions: 5253 Accepted: 2574Case Time Limit: 1000MSDescriptionAfter heari原创 2017-03-02 23:49:05 · 227 阅读 · 0 评论 -
POJ - 1050 To the Max(区间DP最大字串和,最大子矩阵和模板)
To the MaxTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 48400 Accepted: 25619DescriptionGiven a two-dimensional array of positive and negative integer原创 2017-04-05 22:17:27 · 475 阅读 · 0 评论