07 2018 档案
摘要:题目链接:https://www.luogu.org/problemnew/show/P2194 第一问:缩点并且统计其强连通分量里的最小耗费。把所有强连通分量的最小耗费加起来。 第二问:统计在每个强连通分量里与最小耗费相同的点数。乘法原理统计所有强连通分量答案。 include include i
阅读全文
摘要:题目链接:https://www.luogu.org/problemnew/show/P3627 把点权转化到边权上去。 include include include include include include using namespace std; const int maxn = 500
阅读全文
摘要:题目链接:https://www.luogu.org/problemnew/show/P2860 考虑在无向图上缩点。 运用到边双、桥的知识。 缩点后统计度为1的点。 度为1是有一条路径,度为2是有两条路径。 include include include include include using
阅读全文
摘要:题目链接:https://www.luogu.org/problemnew/show/P1262 注意: 1.缩点时计算出入度是在缩完点的图上用color计算。不要在原来的点上计算。 2.枚举出入度时是在缩完点的图上计算。枚举范围到num。 include include include inclu
阅读全文
摘要:题目链接:https://www.luogu.org/problemnew/show/P2397 卡空间。 对于众数出现次数 n/2 我们考虑rand。 每次正确的概率为1/2,五个测试点,全对的概率为1/32。 所以: include include include using namespace
阅读全文
摘要:题目链接:https://www.luogu.org/problemnew/show/P3388 include include include include define ll long long using namespace std; const int maxn = 500000 + 10
阅读全文
摘要:题目链接:https://www.luogu.org/problemnew/show/P2812 注意:判断出入度是否为0的时候枚举只需到颜色的数量。 坑点:当只有一个强连通分量时,不需要再添加新边。即子任务B ans = 0。 子任务B证明:若每个点都相连通,出入度都必须为1。 保证所有点的出入度
阅读全文
摘要:题目链接:https://www.luogu.org/problemnew/show/P3385 SPFA判负环。 这个题必须卡一卡才过得去。 按理说对于一个负环点应当是入队 n次。 但是这个题数据不是很友好qwq 所以我们把入队次数变成 = (n/4)次。 到考试的时候你说是写 n 还是 (n/4
阅读全文
摘要:题解报告:https://www.luogu.org/problemnew/show/P2341 我们把图中的强连通分量缩点,然后只有出度为0的牛是受欢迎的,这样如果出度为0的牛只有一个,说明受所有牛欢迎。否则出度为0只是受一些牛欢迎。
阅读全文
摘要:题目链接:https://www.luogu.org/problemnew/show/P2863 求强连通分量大小 自己单个点的
阅读全文
摘要:题目链接:https://www.luogu.org/problemnew/show/P2002 缩点把原图变为DAG,再在DAG上判断找入度为0的点的个数。 注意一点出度为0的点的个数不等于入度为0的点。 include include include include include using
阅读全文
摘要:题目链接:https://www.luogu.org/problemnew/show/P2169 tarjan缩点 + SPFA 缩完点之后加边注意别写错。 也可以不用建两个图,可以在一张图上判断是否强连通再SPFA. include include include include include
阅读全文
摘要:无优化:500ms deque优化:400ms include include include include include using namespace std; const int maxn = 550000; const int inf = 0x7fffffff; int dis[maxn
阅读全文
摘要:题目链接:https://www.luogu.org/problemnew/show/P2939 本来说是双倍经验题,跟飞行路线一样的,结果我飞行路线拿deque优化SPFA过了这里过不了了。 所以多学一种优先队列优化。 include include include include include
阅读全文
摘要:题目链接:https://www.luogu.org/problemnew/show/P4568 卡了一晚上,算是分层图最短路的模板。注意卡SPFA,所以我写了个SLF优化。 同时 AC400祭!~ include include include include include define ri
阅读全文
摘要:题目链接:http://noi.openjudge.cn/ch0206/9277/ ... include include include include using namespace std; struct Matrix{ long long m[3][3]; }A,E,ans; long lo
阅读全文
摘要:题目链接:https://www.luogu.org/problemnew/show/P4231 诶 我很迷啊..这跟树状数组有什么关系啊...拿二阶差分数组过了..?
阅读全文
摘要:题目链接:https://www.luogu.org/problemnew/show/P2880 是你逼我用ST表的啊qaq include include include include using namespace std; const int maxn = 500001; int minst
阅读全文
摘要:王强怎么这么强啊 王强太强了 二维树状数组
阅读全文

浙公网安备 33010602011771号