hdu 3986 Harry Potter and the Final Battle】的更多相关文章

Harry Potter and the Final Battle Time Limit: 5000/3000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2118    Accepted Submission(s): 580 Problem Description The final battle is coming. Now Harry Potter is located…
http://acm.hdu.edu.cn/showproblem.php?pid=3986 [题意] 给定一个有重边的无向图,T=20,n<=1000,m<=5000 删去一条边,使得1~n的最短路最长 求最短路最长是多少 [思路] 一定是删最短路上的边 可以先跑一个Dijkstra,求出最短路,然n后枚举删边 朴素的Dijkstra为n^2,枚举删边(n条)需要的总时间复杂度是n^3 堆优化Dijkstra(nlogn),总复杂度为n^2logn 有多重边,用邻接矩阵不方便,用邻接表方便,…
一个水题WA了60发,数组没开大,这OJ也不提示RE,光提示WA...... 思路:先求出最短路,如果删除的边不是最短路上的,那么对结果没有影响,要有影响,只能删除最短路上的边.所以枚举一下最短路上的边,每次求最短路即可. #include<stdio.h> #include<vector> #include<string.h> #include<queue> #include<algorithm> using namespace std; +…
给你一个无向图,然后找出当中的最短路, 除去最短路中的随意一条边,看最糟糕的情况下, 新的图中,第一个点到末点的最短路长度是多少. 我的做法是: 首先找出最短路,然后记录路径, 再一条一条边的删, 删一条算一下最短路长度, 之后恢复这条边,删掉下一条边继续算, 以此类推. 看之中最糟糕的情况下,最短路长度是多少, 假设是无穷大则代表最坏情况为不通,按题意输出-1就可以, 否则输出最坏情况下,最短路长度. 我用spfa和链式向前星做的, 代码例如以下: #include<iostream> #i…
Harry Potter and the Final Battle Time Limit: 5000/3000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 3239    Accepted Submission(s): 906 Problem Description The final battle is coming. Now Harry Potter is located…
Harry Potter and the Hide Story Problem Description iSea is tired of writing the story of Harry Potter, so, lucky you, solving the following problem is enough.   Input The first line contains a single integer T, indicating the number of test cases. E…
http://acm.hdu.edu.cn/showproblem.php?pid=3986 从开始的最短路里依次删一条边,求新的最短路,求最长的最短路 删边操作要标记节点以及节点对应的边 #include <iostream> #include <cstdio> #include <cstring> #include <queue> using namespace std ; const int INF=0xfffffff ; struct node{ i…
Harry Potter and the Forbidden Forest Time Limit: 5000/3000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 2089    Accepted Submission(s): 702 Problem Description Harry Potter notices some Death Eaters try to slip…
view code//hdu 3987 #include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #include <queue> using namespace std; typedef long long ll; const ll INF = 1LL<<59; const ll E = 100001; const int N = 10…
对修改操作按时间分治,设$solve(l,r,n,m)$为考虑时间在$[l,r]$的修改操作,作用范围是$n$个点,$m$条边的图. 若$l=r$,则暴力Tarjan统计桥边个数即可. 否则提取出$[l,r]$内涉及修改的所有边$E$,并将端点标记为$V$,显然$|V|=O(|E|)$. 加入$m$条边里除了$E$之外的所有边,显然无论怎么修改,这些边都会存在. Tarjan求出边双连通分量,将边双缩点,可以得到一个森林,那么非树边永远都不可能成为桥,直接删除即可. 还可以注意到的是,还未加入的…
Description \(n,q,V\leq 100000,w_i\leq 10^9\) Solution 又是一道大数据结构 由于有一个下取整,这就导致了不同时间的修改值是不能简单的直接加在一起的. 容易发现,1操作的影响只会影响到距离不超过log的点. 这样我们很容易得到一个\(q\log n\log ^2V\)的做法 同一深度的修改有一种套路是维护BFS序. 对于子树内的点,我们将log个深度对应的BFS序区间减去相应的影响. 对于修改点的log个有用的祖先,我们也类似操作,注意重复影响…
Description Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning, each grid of this board is consisting of grass or just empty and then they start to fire all the grass. Firstly they c…
状压BFS 注意在用二维字符数组时,要把空格.换行处理好. #include<stdio.h> #include<algorithm> #include<string.h> #include<queue> using namespace std; #define INF 0x3f3f3f3f int sx,sy,C,n,m; int ans; ][][<<]; ][]; ][]; ,,-,},dy[]={,,,-}; <=a&&am…
Problem - 3982 题意就是给出一个圆心在原点半径为R的圆形蛋糕,上面有一个cherry,对蛋糕切若干刀,最后要求求出有cherry的那块的面积占整个蛋糕的多少. 做法显而易见,就是一个半平面交,将有向直线的方向根据cherry的位置确定好,然后就进行半平面交,得到一个多边形. 再将多边形用之前几个代码的圆与多边形交,求出区域的大小,再除以整个蛋糕的面积即可. 注意,这样做的时候,精度是要用1e-6或者是1e-4,太高了反而过不了数据. ——written by Lyon…
转自——http://blog.csdn.net/qwe20060514/article/details/8112550 =============================以下是最小生成树+并查集======================================[HDU]1213   How Many Tables   基础并查集★1272   小希的迷宫   基础并查集★1325&&poj1308  Is It A Tree?   基础并查集★1856   More i…
=============================以下是最小生成树+并查集====================================== [HDU] 1213 How Many Tables 基础并查集★ 1272 小希的迷宫 基础并查集★ 1325&&poj1308 Is It A Tree? 基础并查集★ 1856 More is better 基础并查集★ 1102 Constructing Roads 基础最小生成树★ 1232 畅通工程 基础并查集★ 123…
=============================以下是最小生成树+并查集====================================== [HDU] 1213 How Many Tables 基础并查集★ 1272 小希的迷宫 基础并查集★ 1325&&poj1308 Is It A Tree? 基础并查集★ 1856 More is better 基础并查集★ 1102 Constructing Roads 基础最小生成树★ 1232 畅通工程 基础并查集★ 123…
转自:http://blog.csdn.net/shahdza/article/details/7779273 最短路 [HDU] 1548 A strange lift基础最短路(或bfs)★2544 最短路 基础最短路★3790 最短路径问题基础最短路★2066 一个人的旅行基础最短路(多源多汇,可以建立超级源点和终点)★2112 HDU Today基础最短路★1874 畅通工程续基础最短路★1217 Arbitrage 货币交换 Floyd (或者 Bellman-Ford 判环)★124…
出处:http://blog.csdn.net/shahdza/article/details/7779273 最短路 [HDU] 1548    A strange lift基础最短路(或bfs)★ 2544    最短路  基础最短路★ 3790    最短路径问题基础最短路★ 2066    一个人的旅行基础最短路(多源多汇,可以建立超级源点和终点)★ 2112    HDU Today基础最短路★ 1874    畅通工程续基础最短路★ 1217    Arbitrage   货币交换…
[HDU] 1548 A strange lift 根蒂根基最短路(或bfs)★ 2544 最短路 根蒂根基最短路★ 3790 最短路径题目 根蒂根基最短路★ 2066 一小我的观光 根蒂根基最短路(多源多汇,可以建树超等源点和终点)★ 2112 HDU Today 根蒂根基最短路★ 1874 通顺工程续 根蒂根基最短路★ 1217 Arbitrage   货币互换 Floyd (或者 Bellman-Ford 判环)★ 1245 Saving James Bond 策画几何+最短路★ 1317…
=============================以下是最小生成树+并查集====================================== [HDU] How Many Tables 基础并查集★ 小希的迷宫 基础并查集★ &&poj1308 Is It A Tree? 基础并查集★ More is better 基础并查集★ Constructing Roads 基础最小生成树★ 畅通工程 基础并查集★ 还是畅通工程 基础最小生成树★ 畅通工程 基础最小生成树★ 畅通…
Harry Potter and the Final Battle Submit Status Description The final battle is coming. Now Harry Potter is located at city 1, and Voldemort is located at city n. To make the world peace as soon as possible, Of course, Harry Potter will choose the sh…
H - A + B Strikes Back A + B is often used as an example of the easiest problem possible to show some contest platform. However, some scientists have observed that sometimes this problem is not so easy to get accepted. Want to try? Input The input co…
唔 神题一道 大家感受一下 1873. GOV Chronicles Time limit: 0.5 secondMemory limit: 64 MB A chilly autumn night. Well wrapped up in a coat, a man is rapidly walking along a gray street. This is the Tradition Keeper of the ACM club in Ural State University. Drizzl…
靶机说明: Game of Thrones Hacking CTF This is a challenge-game to measure your hacking skills. Set in Game of Thrones fantasy world. Goal: Get the 7 kingdom flags and the 4 extra content flags (3 secret flags + final battle flag). There are 11 in total.…
Day 0 最后一个早上,早读完后就到机房里,复习了左偏树和计算几何,然后真的不知道还要做什么了(FFT和一些数论的结论昨天复习过了 也许还要去学一点新东西(?),像Krusk重构树什么的.(一直没有学过 等一下十一点多就要出发去动车站前往福州了(老师居然买了中午一点半的动车) 愉快地跑来写博客. “最后这几个单位时间很重要,你们要能及时查缺补漏,使自己达到一个饱和状态,又充满了自信!!” 自信?还是有的吧.(雾.. 10:14:34 刚刚去打了一遍FFT,结果RE了两组,FFT的数组要开大两倍…
package com.opslab.util; import java.io.UnsupportedEncodingException; /** * Various character and character sequence utilities, including <code>char[]</code> - <code>byte[]</code> conversions. */public final class CharUtil { /** *…
package com.opslab.util.web; import com.opslab.util.CharUtil;import com.opslab.util.CharsetUtil;import com.opslab.util.StringUtil; import javax.servlet.http.HttpServletRequest;import java.io.ByteArrayOutputStream;import java.io.UnsupportedEncodingExc…
题目链接:hdu 4771 Stealing Harry Potter's Precious 题目大意:在一个N*M的银行里,贼的位置在'@',如今给出n个宝物的位置.如今贼要将全部的宝物拿到手.问最短的路径,不须要考虑离开. 解题思路:由于宝物最多才4个,加上贼的位置,枚举两两位置,用bfs求两点距离,假设存在两点间不能到达,那么肯定是不能取全然部的宝物. 然后枚举取宝物的顺序.维护ans最小. #include <cstdio> #include <cstring> #incl…
2019 杭电多校 7 1006 题目链接:HDU 6651 比赛链接:2019 Multi-University Training Contest 7 Problem Description Final Exam is coming! Cuber QQ has now one night to prepare for tomorrow's exam. The exam will be a exam of problems sharing altogether \(m\) points. Cub…