D. Closest Equals Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://www.lydsy.com/JudgeOnline/problem.php?id=3224 Description You are given sequence a1, a2, ..., an and m queries lj, rj (1 ≤ lj ≤ rj ≤ n). For each query you need to print the minimu…
Bridge Across Islands Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7632 Accepted: 2263 Special Judge Description Thousands of thousands years ago there was a small kingdom located in the middle of the Pacific Ocean. The territory…
题目描述 给定一个由小写字母a到z组成的字符串S,其中第i个字符为S[i](下标从0开始).你需要完成下面两个操作:INSERT c 其中c是一个待输入的字符.你需要在字符串的末尾添加这个字符.保证输入的字符同样是a到z之间的一个小写字母.QUERY x 其中x是一个输入的整数下标.对于这个询问,你需要回答在S当中和S[x]相等且与x最近的距离.输入保证x在当前字符串中合法.例如S = "abcaba",如果我们操作:INSERT a 则在S的末端加一个字符a,S变成&q…
好久没碰到这么友好乱搞的题了.... A. 数列 考察的是exgcd的相关知识,最后的答案直接O(1)求即可 B. 数对 本来以为是原题,然后仔细看了看发现不是,发现不会只好乱搞骗分了 事实上直接按$a+b$为第一关键字,然后就是原题了..... C. 最小距离 事实上这道题的思路还是不错的,考场上联想树上直径问题于是想到了 观察数据范围,我们好像只能跑一遍最短路 那么如何在一遍中求出$p$个点的距离,可以记录一个$pre_{i},dis_{i}$分别表示i节点到任意源点的最短距离,和源点是谁…
Post office 题目描述 There are N(N<=1000) villages along a straight road, numbered from 1 to N for simplicity. We know exactly the position of every one (noted pos[i],pos[i] is positive integer and pos[i]<=10^8). The local authority wants to build a pos…
主题: Quoit Design Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 136 Accepted Submission(s): 77 Problem Description Have you ever played quoit in a playground? Quoit is a game in which flat rin…
Given a Binary Search Tree (BST) with the root node root, return the minimum difference between the values of any two different nodes in the tree. Example : Input: root = [4,2,6,1,3,null,null] Output: 1 Explanation: Note that root is a TreeNode objec…
Given a Binary Search Tree (BST) with the root node root, return the minimum difference between the values of any two different nodes in the tree. Example : Input: root = [4,2,6,1,3,null,null] Output: 1 Explanation: Note that root is a TreeNode objec…
分治法 Sample Input20 01 121 11 13-1.5 00 00 1.50 Sample Output0.710.000.75 # include <iostream> # include <cstdio> # include <cstring> # include <algorithm> # include <string> # include <cmath> # include <queue> # i…
Save Labman No.004 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1473 Accepted Submission(s): 484 Problem Description Due to the preeminent research conducted by Dr. Kyouma, human beings ha…