[UOJ30/Codeforces Round #278 E]Tourists】的更多相关文章

传送门 好毒瘤的一道题QAQ,搞了好几好几天. UOJ上卡在了53个点,CF上过了,懒得优化常数了 刚看时一眼Tarjan搞个强连通分量然后缩点树链剖分xjb搞搞就行了,然后写完了,然后WA了QAQ. 思考了一会把代码全删了,加了个mulutiset重写一遍,然后又是各种WA. 然后去看了POPOQQQ大爷的代码.原来把无向图缩成一个树用的是点双联通分量,搞不清图论的概念只能自扇脸.. 然后去研究了点双联通分量,搞了一道题,顺便给Trajn搞了个小总结. 这道题其实就是缩点然后剖剖剖.但是我的姿…
1.感谢taorunz老师 2.题目大意:就是给个带权无向图,然后有两种操作, 1是修改某个点的权值 2是询问,询问一个值,就是u到v之间经过点权的最小值(不可以经过重复的点) 操作数,点数,边数都不超过100000 3.分析:首先看这道题,就感觉用双联通+树剖搞一搞可以过,可是怎么搞呢 首先双联通是必然的了,可是正常的缩点+树剖会爆零随便试试就知道了 然后我们需要不正常的缩点,我们在正常的缩点后加入割点,割点向它所属的一切双联通分量连边 这样,我们就不怕询问的u和v中有割点了,可是虽然询问是l…
- 学习了一波圆方树 学习了一波点分治 学习了一波可删除堆(巧用 ? STL) 传送门: Icefox_zhx 注意看代码看怎么构建圆方树的. tips:tips:tips:圆方树内存记得开两倍 CODE #include <vector> #include <queue> #include <cstdio> #include <cctype> #include <cstring> #include <algorithm> using…
题目链接:http://codeforces.com/contest/488 A. Giga Tower Giga Tower is the tallest and deepest building in Cyberland. There are 17 777 777 777 floors, numbered from  - 8 888 888 888 to 8 888 888 888. In particular, there is floor 0 between floor  - 1 and…
B. Candy Boxes Problem's Link:   http://codeforces.com/contest/488/problem/B Mean: T题目意思很简单,不解释. analyse: 这道题还是很有意思的,需要考虑到各种情况才能AC. 解这个题目之前,首先要推出两条式子 x4=3x1 4x1=x2+x3 然后就是分类讨论,枚举各种情况就可. Time complexity: O(1) Source code:  // Memory Time // 1347K 0MS…
B. Strip Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/487/problem/B Description Alexandra has a paper strip with n numbers on it. Let's call them ai from left to right. Now Alexandra wants to split it into some pieces (p…
A. Fight the Monster Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/487/problem/A Description A monster is attacking the Cyberland! Master Yang, a braver, is going to beat the monster. Yang and the monster each have 3 attr…
A 这么简单的题直接贴代码好了. #include <cstdio> #include <cmath> using namespace std; bool islucky(int a) { a = abs(a); while(a) { == ) return true; a /= ; } return false; } int main(void) { ; scanf("%d", &a); while(!islucky(a + b)) b++; prin…
A A monster is attacking the Cyberland! Master Yang, a braver, is going to beat the monster. Yang and the monster each have 3 attributes: hitpoints (HP), offensive power (ATK) and defensive power (DEF). During the battle, every second the monster's H…
Description Cyberland 有 n 座城市,编号从 1 到 n,有 m 条双向道路连接这些城市.第 j 条路连接城市 aj 和 bj.每天,都有成千上万的游客来到 Cyberland 游玩. 在每一个城市,都有纪念品售卖,第 i 个城市售价为 wi.这个售价有时会变动. 每一个游客的游览路径都有固定起始城市和终止城市,且不会经过重复的城市. 他们会在路径上的城市中,售价最低的那个城市购买纪念品. 你能求出每一个游客在所有合法的路径中能购买的最低售价是多少吗? 你要处理 q个操作:…