题面 给出一个长度为 n n n 的数列 { a i } \{a_i\} {ai} 和一个长度为 m m m 的数列 { b i } \{b_i\} {bi},求 { a i } \{a_i\} {ai} 有多少个长度为 m m m 的连续子数列能与 { b i } \{b_i\} {bi} 匹配. 两个数列可以匹配,当且仅当存在一种方案,使两个数列中的数可以两两配对,两个数可以配对当且仅当它们的和不小于 h h h. 1 ≤ m ≤ n ≤ 150000. 1\leq m\leq n\…
Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 3192 Accepted Submission(s): 371 Problem Description You are given a rooted tree of N nodes, labeled from 1 to N. To the ith node a non-negat…
传送门 Problem Statement You are given a tree where each node is labeled from 1 to n. How many similar pairs(S) are there in this tree? A pair (A,B) is a similar pair if the following are true: node A is the ancestor of node B abs(A−B)≤T Input format: T…
uva12546. LCM Pair Sum One of your friends desperately needs your help. He is working with a secret agency and doing some encoding stuffs. As the mission is confidential he does not tell you much about that, he just want you to help him with a specia…