分类 - 动态规划

? 解题记录 ? ? LOJ ? ? 动态规划 ? ? 组合数 ?    2018-10-06 10:45:31    634    0    0
地址:https://loj.ac/problem/2567 看来在组合计数的路上,还有很长一段路要走啊…… 首先ai,bi≤109" role="presentation" style="position: relative;">ai,bi≤109ai,bi≤109a_i,b_i\leq 10^9,显然dp" role="presentation" style="position: relative;">dpdpdp不能和值域有关。 考虑最终的答案,发现答案统计的时候每一个学校只是在分界点之间做前缀和。 考虑O(n)" role="presen
? 解题记录 ? ? BZOJ ? ? 动态规划 ? ? 组合数 ?    2018-09-25 08:00:44    556    0    0
Description在 Byteland一共开着 n家商店,编号依次为 1到 n,其中编号为1到 m的商店有日消费量上限,第 i家商店的日消 费量上限为wi。Byteasar每次购物的过程是这样的:依次经过每家商店,然后购买非负整数价格的商品,并在结账 的时候在账本上写上在这家商店消费了多少钱。当然,他在这家商店也可以什么都不买,然后在账本上写上一个0 。这一天, Byteasar日常完成了一次购物,但是他不慎遗失了他的账本。他只记得自己这一天一共消费了多少钱 ,请写一个程序,帮助 Byteasar计算有多少种可能的账单。    Input第一行包含三个正整数 
? 解题记录 ? ? Atcoder ? ? 动态规划 ? ? 构造 ?    2018-09-18 21:41:12    818    0    2
Problem StatementThere is a string s consisting of a and b. Snuke can perform the following two kinds of operation any number of times in any order: Choose an occurrence of aa as a substring, and replace it with b.Choose an occurrence of bb as a subs
? 解题记录 ? ? Codeforces ? ? 动态规划 ? ? 组合数 ?    2018-09-18 08:10:36    303    0    0
Kuro has recently won the "Most intelligent cat ever" contest. The three friends then decided to go to Katie's home to celebrate Kuro's winning. After a big meal, they took a small break then started playing games. Kuro challenged Katie to create a game with only a white paper, a pencil, a pair of s
? 解题记录 ? ? Codeforces ? ? 动态规划 ?    2018-09-16 16:14:11    459    0    0
You are given a square board, consisting of n" data-mce-tabindex="0">nn rows and n" data-mce-tabindex="0">nn columns. Each tile in it should be colored either white or black. Let's call some coloring beautiful if each pair of adjacent rows are either the same or d
? 解题记录 ? ? Codeforces ? ? 动态规划 ?    2018-09-13 22:57:18    500    0    0
For an array b" data-mce-tabindex="0">bb of length m" data-mce-tabindex="0">mm we define the function f" data-mce-tabindex="0">ff as f(b)={b[1]if m=1f(b[1]⊕b[2],b[2]⊕b[3],…,b[m−1]⊕b[m])otherwise,"
? 解题记录 ? ? Codeforces ? ? 动态规划 ? ? 数位dp ? ? 搜索 ?    2018-09-13 22:52:19    465    0    0
output standard output Let's call some positive integer classy if its decimal representation contains no more than 3" data-mce-tabindex="0">33 non-zero digits. For example, numbers 4" data-mce-tabindex="0">44, 200000" data-mce-tabindex="0">200000200000, 1
? 解题记录 ? ? 动态规划 ? ? 状态压缩 ?    2018-08-25 08:46:11    899    0    0
【题目描述】给你n个k维0/1向量组成的串a[n]。 定义向量a <= b当且仅当a中每一个1出现的位置在b中都是1 比如{0,1,0,1}<={0,1,0,1}, {0,1,0,1}<={0,1,1,1} 但是{0,1,0,1}和{1,0,0,1}没有这样的关系 现在请你统计这个串中有多少个不下降子序列。 一个子序列是一个1~n组成的序列, 其中每个元素都满足i < j且a[i] <= a[j]。 【输入】第一行两个正整数n,k。n表示串的长度,k表示向量维数 下面n行每一行一个0/1字符串表示一个k维向量 【输出】输出一个整数,表示不下降序列个数。 【输入样例
? 解题记录 ? ? Atcoder ? ? 动态规划 ?    2018-07-13 22:49:19    1149    0    0
Problem StatementFind the number of the possible tuples of sequences (A0,A1,…,AN) that satisfy all of the following conditions, modulo M: For every i (0≤i≤N), Ai is a sequence of length i consisting of integers between 1 and K (inclusi
? 解题记录 ? ? 洛谷 ? ? 动态规划 ?    2018-06-24 23:05:30    611    0    0
题目描述有n家洗车店从左往右排成一排,每家店都有一个正整数价格p[i]。有m个人要来消费,第i个人会驶过第a[i]个开始一直到第b[i]个洗车店,且会选择这些店中最便宜的一个进行一次消费。但是如果这个最便宜的价格大于c[i],那么这个人就不洗车了。请给每家店指定一个价格,使得所有人花的钱的总和最大。 输入输出格式输入格式:   第一行包含两个正整数n,m(1<=n<=50,1<=m<=4000)。接下来m行,每行包含三个正整数a[i],b[i],ci   输出格式:   第一行输出一个正整数,即消费总额的最大值。第二行输出n个正整数,依次表