题目链接:https://nanti.jisuanke.com/t/30994 样例输入: 5 5 6 0 4 5 1 1 3 4 1 2 2 3 1 3 1 2 1 4 样例输出: 55 样例输入: 1 -100 0 0 样例输出: 0 题解: 把n道题目做了或者没做作为状态,裸的状压DP. 其中当前的时间 t,就是当前做了的题目数量加上1. AC代码: #include<bits/stdc++.h> using namespace std; typedef long long ll; co…
题目链接:https://nanti.jisuanke.com/t/31001 题意: 一带权有向图,有 n 个节点编号1~n,m条有向边,现在一人从节点 1 出发,他有最多 k 次机会施展魔法使得某一条边的权变成 0,问他走到节点 n 的最小权值为多少. 题解: 将dist数组和vis数组都扩展一维: dist[c][i]代表:已经使用了 c 次变0魔法后,走到节点 i 的最短距离: vis[c][i]代表:已经使用了 c 次变0魔法后,走到节点 i 的最短距离,这个最短距离是否已经被准确计算…
题目链接:https://nanti.jisuanke.com/t/30999 样例输入258 样例输出814 题意: squarefree数是指不含有完全平方数( 1 除外)因子的数, 现在一个数字 $n$,可以表示成两个squarefree数 $a,b$ 相乘,即 $n = ab$, 假设 $f\left( n \right)$ 代表了 $n$ 分解成不同的数对 $\left( {a,b} \right)$ 的个数, 现在给你一个 $n$,要求 $f\left( 1 \right) + f\…
题目链接:https://nanti.jisuanke.com/t/31436 作为一名车手,为了提高自身的姿势水平,平时的练习是必不可少的.小 J 每天的训练包含 $N$ 个训练项目,他会按照某个顺序依次练习这些项目.出于一些玄妙的原因,训练的效果跟项目的顺序有着很大关系.当项目 $i$ 被安排在项目 $j$ 之前进行训练,小 J 会获得 $a_{i,j}$ 的熟练度,否则他会获得 $a_{j,i}$ 的熟练度.为了使训练效果尽可能好,小 J 希望这 $\frac{N(N-1)}2$ 对项目的…
题目链接: https://nanti.jisuanke.com/t/30994 Dlsj is competing in a contest with n (0 < n \le 20)n(0<n≤20) problems. And he knows the answer of all of these problems. However, he can submit ii-th problem if and only if he has submitted (and passed, of c…
题目链接:https://nanti.jisuanke.com/t/30996 During tea-drinking, princess, amongst other things, asked why has such a good-natured and cute Dragon imprisoned Lpl in the Castle? Dragon smiled enigmatically and answered that it is a big secret. After a pau…
题目链接:https://nanti.jisuanke.com/t/30990 Alice, a student of grade 6, is thinking about an Olympian Math problem, but she feels so despair that she cries. And her classmate, Bob, has no idea about the problem. Thus he wants you to help him. The proble…
Resource Archiver Time Limit: 20000/10000 MS (Java/Others)    Memory Limit: 100000/100000 K (Java/Others)Total Submission(s): 2382    Accepted Submission(s): 750 Problem Description Great! Your new software is almost finished! The only thing left to…
Wireless Password Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5640    Accepted Submission(s): 1785 Problem Description Liyuan lives in a old apartment. One day, he suddenly found that there…
题目链接 BZOJ1559 题解 考虑到这是一个包含子串的问题,而且子串非常少,我们考虑\(AC\)自动机上的状压\(dp\) 设\(f[i][j][s]\)表示长度为\(i\)的串,匹配到了\(AC\)自动机\(j\)号节点,且已匹配集合为\(s\)的方案数 直接在\(AC\)自动机上转移即可 但是为了防止使用\(last\)指针之类的,计算匹配的串,我们先将原串的集合去重和去包含关系 方案怎么办? 考虑到\(ans \le 42\),一定是刚好若干个原串以最长前后缀相同的方式相接 因为如果不…