BestCoder Round #68 (div.2)】的更多相关文章

tree Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 863    Accepted Submission(s): 409 Problem Description There is a tree(the tree is a connected graph which contains n points and n−1 edges),t…
并查集 1002 tree 题意:中文题面 分析:(官方题解)把每条边权是1的边断开,发现每个点离他最近的点个数就是他所在的连通块大小. 开一个并查集,每次读到边权是0的边就合并.最后Ansi=size[findset(i)],sizeAns_i=size[findset(i)],sizeAns​i​​=size[findset(i)],size表示每个并查集根的size. 其实DFS也能过. #include <cstdio> #include <cstring> #includ…
geometry Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 340    Accepted Submission(s): 256 Problem Description There is a point P at coordinate (x,y).A line goes through the point, and intersec…
题意:给你一个图,每条边权值0或1,问每个点周围最近的点有多少个? 思路:并查集找权值为0的点构成的连通块. #include<stdio.h> #include<string.h> #include<stdlib.h> #include<math.h> #include<algorithm> #define clc(a,b) memset(a,b,sizeof(a)) using namespace std; ],a[];//标记根节点 int…
Baby Ming and Weight lifting Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 681    Accepted Submission(s): 280 Problem Description Baby Ming is fond of weight lifting. He has a barbell pole(the…
HDOJ5054 Alice and Bob Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 302    Accepted Submission(s): 229 Problem Description Bob and Alice got separated in the Square, they agreed that if they…
LCP Array  Accepts: 131  Submissions: 1352  Time Limit: 4000/2000 MS (Java/Others)  Memory Limit: 131072/131072 K (Java/Others) 问题描述 Peter有一个字符串s=s_{1}s_{2}...s_{n}s=s​1​​s​2​​...s​n​​, 令\text{suff}_i =s_{i}s_{i+1}...s_{n}suff​i​​=s​i​​s​i+1​​...s​n​…
Shortest Path  Accepts: 40  Submissions: 610  Time Limit: 4000/2000 MS (Java/Others)  Memory Limit: 131072/131072 K (Java/Others) 问题描述 有一条长度为nn的链. 节点ii和i+1i+1之间有长度为11的边. 现在又新加了3条边, 每条边长度都是1. 给出mm个询问, 每次询问两点之间的最短路. 输入描述 输入包含多组数据. 第一行有一个整数TT, 表示测试数据的组数…
Rikka with Phi  Accepts: 5  Submissions: 66  Time Limit: 16000/8000 MS (Java/Others)  Memory Limit: 131072/131072 K (Java/Others) Problem Description Rikka and Yuta are interested in Phi function (which is known as Euler's totient function). Yuta giv…
Rikka with Graph  Accepts: 123  Submissions: 525  Time Limit: 2000/1000 MS (Java/Others)  Memory Limit: 65536/65536 K (Java/Others) 问题描述 众所周知,萌萌哒六花不擅长数学,所以勇太给了她一些数学问题做练习,其中有一道是这样的: 给出一张 nn 个点 n+1n+1 条边的无向图,你可以选择一些边(至少一条)删除. 现在勇太想知道有多少种方案使得删除之后图依然联通.…