![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
dp
wzw1105
生而无畏 战至终章
展开
-
F. Yet another 2D Walking--Codeforces Round #515 (Div. 3)【dp】
F. Yet another 2D WalkingDescriptionMaksim walks on a Cartesian plane. Initially, he stands at the point (0,0) and in one move he can go to any of four adjacent point...原创 2018-10-14 00:20:03 · 706 阅读 · 0 评论 -
「CF1197D」Yet Another Subarray Problem【分治或dp】
D. Yet Another Subarray Problemtime limit per test 2 secondsmemory limit per test 256 megabytesinput standard inputoutput standard outputYou are given an array a1,a2,…,ana_1,a_2,…,a_na1,a2,…,a...原创 2019-07-23 09:29:49 · 367 阅读 · 0 评论 -
「Codeforces Round 576 (div2)」题解
传送门:https://codeforces.com/contest/1199C. MP3题解尺取法代码#include<bits/stdc++.h> using namespace std;const int maxn=4e5+10; int n,m,a[maxn],num[maxn],tot=0,sum[maxn]; int solve(int k){...原创 2019-08-01 00:42:59 · 301 阅读 · 0 评论 -
「2019牛客多校第一场I」Points Division【线段树+dp】
题目链接:https://ac.nowcoder.com/acm/contest/881/I题面题解很妙的线段树维护dpdpdp的题首先需要明确的是需要怎样将其划分为两个满足条件的集合,根据题意,可以知道可以用一个台阶将集合划分,如图然后就可以将每个点的yyy进行离散化,然后考虑将这些点优先按照xxx升序,然后yyy升序的规则排序,显然每经过一个点,它所带来的贡献需要修改的是一个区...原创 2019-07-22 21:53:33 · 206 阅读 · 0 评论 -
「2019牛客多校第三场 I」Median【dp】
示例1输入18 30 0101010 10 0101011 21 0101010 10 1100000 30 0101011 -10 1111111 41 0101011 -11 0101010 0输出1223243Invalid题意就是有一个长度为数组为nnn的数组aaa,还有一个长度为n−2n-2n−2的数组bbb,其中b[i]b[i]b[i...原创 2019-07-26 01:10:20 · 344 阅读 · 0 评论 -
「2019牛客多校第二场 J」subarray【dp+差分思想】
题目链接:https://ac.nowcoder.com/acm/contest/882/J题意有一个长度为10910^9109的只包含111和−1-1−1的数组,然后给你n(n<=106)n(n<=10^6)n(n<=106)个区间[li,ri][l_i,r_i][li,ri],表示只有这nnn个区间内的所有数为111,其余的位置的数都为−1-1−1,...原创 2019-07-21 17:36:15 · 495 阅读 · 0 评论 -
「Light OJ1284」Lights inside 3D Grid【概率dp】
1284 - Lights inside 3D GridTime Limit: 4 second(s) Memory Limit: 32 MBYou are given a 3D3D3D grid, which has dimensions X,YX, YX,Y and ZZZ. Each of the X×Y×ZX \times Y \times ZX×Y×Z cells contains ...原创 2019-06-30 11:10:25 · 121 阅读 · 0 评论 -
「Light OJ1265」Island of Survival【概率dp】
1265 - Island of SurvivalTime Limit: 2 second(s) Memory Limit: 32 MBYou are in a reality show, and the show is way too real that they threw into an island. Only two kinds of animals are in the islan...原创 2019-06-30 08:31:52 · 101 阅读 · 0 评论 -
「Light OJ1104」Birthday Paradox【决策单调性优化dp】
1104 - Birthday ParadoxTime Limit: 2 second(s) Memory Limit: 32 MBSometimes some mathematical results are hard to believe. One of the common problems is the birthday paradox. Suppose you are in a p...原创 2019-06-29 12:17:07 · 216 阅读 · 0 评论 -
「Light OJ1038」Race to 1 Again【期望dp】
1038 - Race to 1 AgainTime Limit: 2 second(s) Memory Limit: 32 MB Rimi learned a new thing about integers, which is - any positive integer greater than 111 can be divided by its divisors. So, he is ...原创 2019-06-28 13:43:48 · 126 阅读 · 0 评论 -
「CF1101F」Trucks and Cities【决策单调优化dp】
F. Trucks and Citiestime limit per test 2 secondsmemory limit per test 256 megabytesinput standard inputoutput standard outputThere are nnncities along the road, which can be represented as a str...原创 2019-06-09 21:00:22 · 293 阅读 · 0 评论 -
「CF960F」Pathwalks【dp+动态开点线段树维护】
F. Pathwalkstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a directed graph with nnn nodes and mmm edges, with all edges having...原创 2019-06-09 11:55:06 · 171 阅读 · 0 评论 -
「CF1067A」Array Without Local Maximums【dp】
A. Array Without Local Maximumstime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputIvan unexpectedly saw a present from one of his previous birth...原创 2019-06-07 20:31:15 · 200 阅读 · 0 评论 -
「sundes OJ1025」TaoSama与煎饼【dp】
TaoSama与煎饼DescriptionInputOutputSample Input 129 56 10 14 2 8 8 18 5 171 3 1 2 113 84 96 10 64 55 13 94 53 5 24 89 8 301 1 1 1 1 2 4 1Sample Output 173455Hint只有样例一TaoSama使用道具顺序为1...原创 2019-06-07 13:51:00 · 146 阅读 · 0 评论 -
「CF981D」Bookshelves【贪心+dp】
D. Bookshelvestime limit per test 1 secondmemory limit per test 256 megabytesinput standard inputoutput standard outputMr Keks is a typical white-collar in Byteland.He has a bookshelf in his off...原创 2019-06-07 00:56:45 · 251 阅读 · 0 评论 -
Codeforces Round #538 (Div. 2)--D. Flood Fill(DP)
题目链接:https://codeforces.com/contest/1114/problem/D题意:给定序列ai,定义一个区间联通当且仅当区间内所有数相同,给定操作如下:开始选定一个起点S(不变且不计入操作数),每次操作可以将包含S在内的联通区间内的所有数变为其他任意一个数,求最小操作数使整个序列内的数相同;解法:DP首先需要明确的是若区间[ l,r ]经过k次操作后变成联通区间...原创 2019-02-12 16:00:34 · 300 阅读 · 0 评论 -
「hdu6701」Make Rounddog Happy【dp+RMQ+分治】
Make Rounddog HappyTime Limit: 2000/2000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 242 Accepted Submission(s): 70Problem DescriptionRounddogRounddogRou...原创 2019-08-21 21:42:30 · 480 阅读 · 0 评论