On September 22, 2004, Oceanic Flight 815 crashed on a mysterious island somewhere in the pacific. There actually were survivors in the crash , N survivors . The mysterious island kept on moving in space - time, so no rescue reached them. Initially e…
C. Glass Carving time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Leonid wants to become a glass carver (the person who creates beautiful artworks by cutting the glass). He already has a re…
Stability Time Limit: 3000/2000 MS (Java/Others) Memory Limit: 65535/102400 K (Java/Others)Total Submission(s): 1347 Accepted Submission(s): 319 Problem Description Given an undirected connected graph G with n nodes and m edges, with possibly r…
感觉做得有点复杂了,但是AC了还是...爽... 题意:给你n个点每个点有一个价值,接下来有m条边,然后是q个操作,每个操作有三种情况: F X K:寻找与X点直接或间接相连的不小于价值K的最小价值,如果找不到就是0 U X K:将X点价值变为K E A B:删除点A与点B形成的边 最后求价值总和的平均值 首先我们看F操作和U操作可以使用map解决,因为这是典型的带修改并区间找寻大于等于某值的最小值.然后我们看删边,如果直接删的话,我们需要遍历这一维map然后拆分,时间过不了.因此我们想到使用离…
C. Glass Carving time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Leonid wants to become a glass carver (the person who creates beautiful artworks by cutting the glass). He already has a re…
1107 Social Clusters (30 分) When register on a social network, you are always asked to specify your hobbies in order to find some potential friends with the same hobbies. A social cluster is a set of people who have some of their hobbies in common. Y…
Description Input 第一行包含一个正整数testcase,表示当前测试数据的测试点编号.保证1≤testcase≤20. 第二行包含三个整数N,M,T,分别表示节点数.初始边数.操作数.第三行包含N个非负整数表示 N个节点上的权值. 接下来 M行,每行包含两个整数x和 y,表示初始的时候,点x和点y 之间有一条无向边, 接下来 T行,每行描述一个操作,格式为“Q x y k”或者“L x y ”,其含义见题目描述部分. Output 对于每一个第一类操作,输出一个非负整数表示答…
3673: 可持久化并查集 by zky Time Limit: 5 Sec Memory Limit: 128 MBSubmit: 1878 Solved: 846[Submit][Status][Discuss] Description n个集合 m个操作操作:1 a b 合并a,b所在集合2 k 回到第k次操作之后的状态(查询算作操作)3 a b 询问a,b是否属于同一集合,是则输出1否则输出0 0<n,m<=2*10^4 Input Output Sample Input 5 6…