按题意把图建出来跑最短路就行了。注意遮挡不会影响答案,所以不必考虑,因为走直线经过遮挡的时候,一定不会比答案更优。 ...
分类:
其他好文 时间:
2017-01-24 21:02:56
阅读次数:
244
题意就是对每个点i,统计在其子树内(不含自身),且depj-depi<=xj的点有多少个。 把点分别按照dep-x和dep进行排序,离线处理, 每次把dep-x小于等于当前dep值的点插入树状数组,就变成了询问dfs序在一个区间内的点有多少个,可以用树状数组轻松解决。 ...
分类:
编程语言 时间:
2017-01-24 21:02:31
阅读次数:
508
algoritm.in / algoritm.out Even though he isn't a student of computer science, Por Costel the pig has started to study Graph Theory. Today he's learni ...
分类:
其他好文 时间:
2017-01-22 07:56:39
阅读次数:
304
semipal.in / semipal.out Por Costel the pig, our programmer in-training, has recently returned from the Petrozaporksk training camp. There, he learned ...
分类:
其他好文 时间:
2017-01-20 07:35:51
阅读次数:
430
semipal.in / semipal.out Por Costel the pig, our programmer in-training, has recently returned from the Petrozaporksk training camp. There, he learned ...
分类:
其他好文 时间:
2017-01-20 07:25:28
阅读次数:
293
meciul.in / meciul.out Oberyn Martell and Gregor Clegane are dueling in a trial by combat. The fight is extremely important, as the life of Tyrion Lan ...
分类:
其他好文 时间:
2017-01-20 07:23:28
阅读次数:
367
Deep Q Network 4.1 DQN 算法更新 4.2 DQN 神经网络 4.3 DQN 思维决策 4.4 OpenAI gym 环境库 Notes Deep Q-learning Algorithm This gives us the final deep Q-learning algor ...
分类:
Web程序 时间:
2017-01-18 08:00:21
阅读次数:
406
f(i,j,S)表示到(i,j),且经由的路径上的颜色集合为S的价值的最小值,从上方和左方转移过来即可。 要注意,内存不足,需要滚动数组优化,即使用了map,还是需要。 路径输出的时候,可以再跑一遍dp,这样就不用再开一个大数组了。 我的写法比较菜。卡了常数 ...
分类:
编程语言 时间:
2017-01-15 22:56:01
阅读次数:
261
题意:给定n个物品,每个物品对于A和B来说具有不同的价值,记为ai,bi,两人交替取,A先手,A总是贪心地取当前剩下的物品中,对于他价值最高的,如果有多个,则任取一个。问B在最坏情况下,能取到的物品的对他的价值和最大是多少。 先把物品以ai为第一关键字,bi为第二关键字排序。这样A每次必定从最左端取 ...
分类:
其他好文 时间:
2017-01-15 22:55:50
阅读次数:
269