ACM International Collegiate Programming Contest, Tishreen Collegiate Programming Contest (2018) Syria, Lattakia, Tishreen University, April, 30, 2018 Problem A. Can Shahhoud Solve it? Problem B. Defeat the Monsters Problem C. UCL Game Night Problem…
C题 Problem C Game Map 思路: 之前暴力搜索写了好几发,一直超时,后面看其他人的题解发现要用记忆化搜索..直接暴力搜的话有太多重 复的计算. dist u 表示以u 为起点所能走的最长路径,通过dfs不断递归能获得以u为起点的最长路径,这条路径上的每个点 的dist必定是最大的(因为如果不是的话就会继续搜下去),当其他路径经过这些点是时直接加上他们的dist就 行了,这样就节省了非常多的操作,降低复杂度. 实现代码: #include<bits/stdc++.h> usin…
Description Recently, researchers on Mars have discovered N powerful atoms. All of them are different. These atoms have some properties. When two of these atoms collide, one of them disappears and a lot of power is produced. Researchers know the way…
题意: 给一个包含N个顶点,M条边,无自环和重边的简单无向图,初始每个点颜色都为0,每条边的长度为1,连接着ai,bi两个节点.经过若干个操作, 每次将与某个点vi距离不超过di的所有点染成某种颜色ci,求最终每个点的颜色. 1 <= N, M, Q <= 1e5, 1 <= ai, bi, vi <= N, ai != bi. 0 <= di <= 10, 1 <= ci <= 1e5. 分析: 考虑对操作逆向,f[k][d]表示以k点为中心,dist=d…