
dp
文章平均质量分 81
C_K_Y_
这个作者很懒,什么都没留下…
展开
-
codeforces 856c Eleventh Birthday
C. Eleventh Birthdaytime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputIt is Borya's eleventh birthday, and he has got a great present: n cards with ...原创 2018-02-26 11:08:49 · 577 阅读 · 0 评论 -
codeforces 914c Travelling Salesman and Special Numbers
C. Travelling Salesman and Special Numberstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe Travelling Salesman spends a lot of time travelling s...原创 2018-02-22 11:13:15 · 501 阅读 · 0 评论 -
codeforces 52B Right Triangles
B. Right Trianglestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a n × m field consisting only of periods ('.') and asterisks ('*')...原创 2018-02-22 11:07:49 · 820 阅读 · 0 评论 -
codeforces 895d string mark
D. String Marktime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAt the Byteland State University marks are strings of the same length. Mark x is con...原创 2018-02-27 16:46:11 · 408 阅读 · 0 评论 -
codeforces895c Square Subsets
C. Square Subsetstime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputPetya was late for the lesson too. The teacher gave him an additional task. For s...原创 2018-02-27 16:40:18 · 505 阅读 · 0 评论 -
codeforces900D Unusual Sequences
D. Unusual Sequencestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputCount the number of distinct sequences a1, a2, ..., an (1 ≤ ai) consisting of p...原创 2018-02-27 16:33:35 · 366 阅读 · 0 评论 -
codeforces 932e Team Work
E. Team Worktime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou have a team of N people. For a particular task, you can pick any non-empty subset ...原创 2018-02-27 15:43:32 · 431 阅读 · 0 评论 -
codeforces 486d Valid Sets
D. Valid Setstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAs you know, an undirected connected graph with n nodes and n - 1 edges is called a tr...原创 2018-02-27 15:25:47 · 271 阅读 · 0 评论 -
codeforces 893e Counting Arrays
E. Counting Arraystime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given two positive integer numbers x and y. An array F is called an y-fa...原创 2018-02-27 11:46:48 · 473 阅读 · 0 评论 -
codeforces869c The Intriguing Obsession
C. The Intriguing Obsessiontime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output— This is not playing but duty as allies of justice, Nii-chan!— Not alli...原创 2018-02-27 11:11:14 · 350 阅读 · 0 评论 -
codeforces 852F Product transformation
F. Product transformationtime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputConsider an array A with N elements, all being the same integer a.Define ...原创 2018-02-27 11:02:35 · 306 阅读 · 0 评论 -
codeforces 886E&&889C Maximum Element
E. Maximum Elementtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputOne day Petya was solving a very interesting problem. But although he used many ...原创 2018-02-27 10:55:10 · 727 阅读 · 0 评论 -
snoi多校模拟赛1.15 t1 travel
解法:树形dp,dp[k][j][i]表示模k意义下以i为终点长度为i的路径是否存在。转移:因为每次最多走一条边,所以只需要枚举k转移即可,方程见代码,很容易想到。边界条件就是能直接到的点的dp距离值=1。代码中为了简化,使用了三个数组,循环使用,来表示当前点状态,后续状态,总状态。这样就能使写代码快很多,还有就是注意,后续状态转移完之后,还要再枚举一次,得到完整的后续状态,不然会WA!ps:从标...原创 2018-01-15 16:02:36 · 264 阅读 · 0 评论 -
snoi多校模拟赛1.16 t1 光之大陆
原题:bzoj28732873: 光之大陆Time Limit: 10 Sec Memory Limit: 256 MBSubmit: 70 Solved: 33[Submit][Status][Discuss]Description在光之大陆的土地上,各种势力盘根错节。来自光之峡谷的精灵,来自黑暗森林的亡灵,来自古老东方的人类共同生活在一起。善于打造装置的矮人,善于发明的侏儒,隐匿于山林的巨...原创 2018-01-16 21:19:08 · 433 阅读 · 0 评论 -
snoi多校模拟赛 1.16 t2
原题:bzoj29002900: 好玩的数字游戏Time Limit: 10 Sec Memory Limit: 512 MBSubmit: 99 Solved: 59[Submit][Status][Discuss]DescriptionTK在虐题的同时,也喜欢玩游戏。现在,有这样的一个游戏,规则是这样的:先随机给出一个数字N,然后你在操场上把1到N的所有数字写成一排,就像这样:123456...原创 2018-01-16 21:32:10 · 500 阅读 · 0 评论 -
snoi多校模拟赛 1.17 t1 path
A 路径规划(path.pas/c/cpp)TL:1S ML:128MB【Description】kAc在数轴上有N片西瓜地。第 i片的坐标是X[i](注意 X并没有排序)。任意两片西瓜地坐标不同。有一天他要给这N片西瓜地浇水。初始他在X[1]的位置。他必须按1..N 的顺序浇水,也就是说,必须先去X[1],再去X[2]...最后到X[n](他可以沿着坐标轴正方向或者负方向走)。给西瓜地浇水不需...原创 2018-01-17 17:48:50 · 320 阅读 · 0 评论 -
bzoj2878 [NOI2012] 迷失游乐园 期望+基环树dp
题目描述放假了,小Z觉得呆在家里特别无聊,于是决定一个人去游乐园玩。进入游乐园后,小Z看了看游乐园的地图,发现可以将游乐园抽象成有n个景点、m条道路的无向连通图,且该图中至多有一个环(即m只可能等于n或者n-1)。小Z现在所在的大门也正好是一个景点。小Z不知道什么好玩,于是他决定,从当前位置出发,每次随机去一个和当前景点有道路相连的景点,并且同一个景点不去两次(包括起始景点)。贪玩的小Z会一直游玩...原创 2018-05-25 16:49:04 · 629 阅读 · 0 评论