随笔分类 -  DP

摘要:https://codeforces.com/problemset/problem/1619/E 用栈处理 #include <bits/stdc++.h> #define ll long long #define ull unsigned long long #define rep(i,a,b) 阅读全文
posted @ 2022-01-14 23:39 DeaL57 阅读(62) 评论(0) 推荐(0)
摘要:求有胜利的情况: 定义dp[i][j],i个人,生命在j内,最后剩1个人的情况 每次每个人损失i-1点生命值,枚举死亡人数k,这些人生命值小于i dp[i][j] += dp[i-k][j-(i-1)]*(i-1)k*Cik 死亡人数有 k 个,我们要从i个人中选出 k 个人来死亡 死亡的人中,因为 阅读全文
posted @ 2022-01-13 17:02 DeaL57 阅读(29) 评论(0) 推荐(0)
摘要:牛过马路 树状数组求逆序对,逆序对数的转化:sum+2*x-n-1 绝世好题 位上的转移 物流运输 最短路+dp 三角形牧场 用dp来枚举可以构成三角形三边长度情况 垃圾陷阱 dp每一个状态最长存活时间 Knapsack 先贪心的拿,然后背包dp 阅读全文
posted @ 2020-12-05 16:14 DeaL57 阅读(201) 评论(0) 推荐(0)
摘要:P2014 [CTSC1997]选课 #include <iostream> #include <vector> #include <algorithm> #include <string> #include <set> #include <queue> #include <map> #includ 阅读全文
posted @ 2020-09-23 15:42 DeaL57 阅读(273) 评论(0) 推荐(0)
摘要:樱花 #include <iostream> #include <vector> #include <algorithm> #include <string> #include <set> #include <queue> #include <map> #include <sstream> #inc 阅读全文
posted @ 2020-09-16 20:53 DeaL57 阅读(118) 评论(0) 推荐(0)
摘要:Tree Painting #include <iostream> #include <vector> #include <algorithm> #include <string> #include <set> #include <queue> #include <map> #include <ss 阅读全文
posted @ 2020-08-14 10:53 DeaL57 阅读(117) 评论(0) 推荐(0)
摘要:k-Tree 对dp数情况的问题还是不太懂 #include <iostream> #include <vector> #include <algorithm> #include <string> #include <set> #include <queue> #include <map> #inc 阅读全文
posted @ 2020-07-27 00:22 DeaL57 阅读(99) 评论(0) 推荐(0)
摘要:1202B - You Are Given a Decimal String... 这个复杂度看着都觉得有点悬(O(100*N)),居然才用500ms #include <iostream> #include <vector> #include <algorithm> #include <strin 阅读全文
posted @ 2020-07-11 13:50 DeaL57 阅读(159) 评论(0) 推荐(0)
摘要:1221D - Make The Fence Great Again 写不出状态转移方程有点难受 #include <iostream> #include <vector> #include <algorithm> #include <string> #include <set> #include 阅读全文
posted @ 2020-07-09 00:26 DeaL57 阅读(135) 评论(0) 推荐(0)
摘要:1249E - By Elevator or Stairs? #include <iostream> #include <vector> #include <algorithm> #include <string> #include <set> #include <queue> #include < 阅读全文
posted @ 2020-07-08 22:12 DeaL57 阅读(233) 评论(0) 推荐(0)
摘要:1283E - New Year Parties #include <iostream> #include <vector> #include <algorithm> #include <string> #include <set> #include <queue> #include <map> # 阅读全文
posted @ 2020-07-06 19:52 DeaL57 阅读(178) 评论(0) 推荐(0)
摘要:You are given a tree consisting of nn vertices. A tree is a connected undirected graph with n−1n−1 edges. Each vertex vv of this tree has a color assi 阅读全文
posted @ 2020-07-03 23:05 DeaL57 阅读(183) 评论(0) 推荐(0)
摘要:Now I think you have got an AC in Ignatius.L's "Max Sum" problem. To be a brave ACMer, we always challenge ourselves to more difficult problems. Now y 阅读全文
posted @ 2020-06-23 10:08 DeaL57 阅读(154) 评论(0) 推荐(0)
摘要:Problem Statement Let NN be a positive odd number. There are NN coins, numbered 1,2,…,N1,2,…,N. For each ii (1≤i≤N1≤i≤N), when Coin ii is tossed, it c 阅读全文
posted @ 2020-06-22 10:41 DeaL57 阅读(197) 评论(0) 推荐(0)
摘要:Description YYF is a couragous scout. Now he is on a dangerous mission which is to penetrate into the enemy's base. After overcoming a series difficul 阅读全文
posted @ 2020-06-22 09:45 DeaL57 阅读(174) 评论(0) 推荐(0)
摘要:Problem Statement There is a grid with HH horizontal rows and WW vertical columns. Let (i,j)(i,j) denote the square at the ii-th row from the top and 阅读全文
posted @ 2020-06-17 11:00 DeaL57 阅读(368) 评论(0) 推荐(0)
摘要:Problem Statement There is a directed graph GG with NN vertices and MM edges. The vertices are numbered 1,2,…,N1,2,…,N, and for each ii (1≤i≤M1≤i≤M), 阅读全文
posted @ 2020-06-17 09:56 DeaL57 阅读(307) 评论(0) 推荐(0)
摘要:Problem Statement You are given strings ss and tt. Find one longest string that is a subsequence of both ss and tt. Notes A subsequence of a string xx 阅读全文
posted @ 2020-06-16 12:29 DeaL57 阅读(183) 评论(0) 推荐(0)
摘要:Problem Statement There are NN items, numbered 1,2,…,N1,2,…,N. For each ii (1≤i≤N1≤i≤N), Item ii has a weight of wiwi and a value of vivi. Taro has de 阅读全文
posted @ 2020-06-16 11:15 DeaL57 阅读(254) 评论(0) 推荐(0)
摘要:Problem Statement There are NN items, numbered 1,2,…,N1,2,…,N. For each ii (1≤i≤N1≤i≤N), Item ii has a weight of wiwi and a value of vivi. Taro has de 阅读全文
posted @ 2020-06-16 10:03 DeaL57 阅读(199) 评论(0) 推荐(0)