标签 - 动态规划

? 解题记录 ? ? 洛谷 ? ? 最短路 ? ? 动态规划 ?    2018-10-09 08:25:53    464    0    0
策策同学特别喜欢逛公园。 公园可以看成一张 N 个点 M 条边构成的有向图,且没有自环和重边。其中 1 号点是公园的入口, N 号点是公园的出口,每条边有一个非负权值,代表策策经过这条边所要花的时间。 策策每天都会去逛公园,他总是从 1 号点进去,从 N 号点出来。 策策喜欢新鲜的事物,他不希望有两天逛公园的路线完全一样,同时策策还是一个特别热爱学习的好孩子,他不希望每天在逛公园这件事上花费太多的时间。如果 1 号点到 N 号点的最短路
? 解题记录 ? ? 洛谷 ? ? 动态规划 ? ? 组合数 ? ? 容斥 ?    2018-10-06 17:42:53    625    0    0
题解 for E:最后的斗争 E.pdf 带标号边-双联通图计数。 先看这道题的部分分: 对于30%" role="presentation" style="position: relative;">30%30%30\% 的数据,我们写一个dfs,找出所有的N" role="presentation" style="position: relative;">NNN个点的边-双联通图打表即可获得。 仍然是对于30%" role="presentation" style="position: relative;">30%
? 解题记录 ? ? LOJ ? ? 动态规划 ? ? 组合数 ?    2018-10-06 10:45:31    669    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:31:27    845    0    0
Description在Byteland一共有n个城市,编号依次为1到n,它们之间计划修建n(n-1)/2条单向道路,对于任意两个不同的点i和 j,在它们之间有且仅有一条单向道路,方向要么是i到j,要么是j到i。换句话说,这是一个n个点的竞赛图。Byte asar居住在1号城市,他希望从1号城市出发,沿着单向道路不重复地访问一些城市,使得访问的城市数尽可能多。 请写一个程序,帮助Byteasar计算有多少种道路修建方式,使得从1号点出发的最长简单路径经过点数恰好为k,由 于答案可能很大,请对P取模输出 Input第一行包含两个正整数n,P,表示点数和模数。 2≤P≤1e9,N<=200
? 解题记录 ? ? BZOJ ? ? 动态规划 ? ? 组合数 ?    2018-09-25 08:00:44    586    0    0
Description在 Byteland一共开着 n家商店,编号依次为 1到 n,其中编号为1到 m的商店有日消费量上限,第 i家商店的日消 费量上限为wi。Byteasar每次购物的过程是这样的:依次经过每家商店,然后购买非负整数价格的商品,并在结账 的时候在账本上写上在这家商店消费了多少钱。当然,他在这家商店也可以什么都不买,然后在账本上写上一个0 。这一天, Byteasar日常完成了一次购物,但是他不慎遗失了他的账本。他只记得自己这一天一共消费了多少钱 ,请写一个程序,帮助 Byteasar计算有多少种可能的账单。    Input第一行包含三个正整数 
? 解题记录 ? ? Atcoder ? ? 动态规划 ? ? 构造 ?    2018-09-18 21:41:12    850    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 ? ? KMP ? ? 动态规划 ?    2018-09-18 09:18:41    509    0    0
You are given a binary string s" data-mce-tabindex="0">ss. Find the number of distinct cyclical binary strings of length n" data-mce-tabindex="0">nn which contain s" data-mce-tabindex="0">ss as a substring. The cyclical string t" data-mce-tabindex="0"
? 解题记录 ? ? Codeforces ? ? 动态规划 ? ? 组合数 ?    2018-09-18 08:10:36    337    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    492    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    528    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&#xA0;m=1f(b[1]&#x2295;b[2],b[2]&#x2295;b[3],&#x2026;,b[m&#x2212;1]&#x2295;b[m])otherwise,"