随笔分类 - 题解
摘要:目录 Description State Input Output Solution Code Description 有 \(m\) 个区间,给出每个区间的和,构造一个 \(01\) 字串 State \(1<=n,m<=2*10^5\) \(1<=l<=r<=n\) \(1<=x<=r-l+1\
阅读全文
摘要:目录 Description State Input Output Solution Code Description 有 \(n\) 本书,每一本书都有一本先导书,从 \(1\) 到 \(n\) 顺序阅读这些书,想要理解一本书,就必须将先导书看完,求阅读这 \(n\) 本书最少多少遍才可以完全理解
阅读全文
摘要:目录 Description State Input Output Solution Code Description 有 \(n\) 个小球,每个小球要放在对应的区间 \([l_i, r_i]\),问是否可以满足所有小球的条件 State \(1<=T<=2*10^5\) \(1<=N<=2*10
阅读全文
摘要:目录 Description State Input Output Solution Code Description 有 \(n\) 条纵向街道, \(m\) 条横向街道,\(k\) 个人在这些街道上,求有几对人相遇所走的路程大于其曼哈顿距离 State \(2<=n,m<=2*10^5\) \(
阅读全文
摘要:目录 Description State Input Output Solution Code Description 将一个数分解成多个数之和,使得这些数的乘积最大 State \(10<=n<=31000\) Input 13 Output 3 108 Solution 前置结论:将数 \(x\
阅读全文
摘要:目录 Description State Input Output Solution Code Description 从一个长度为 \(n\) 的序列中,找到只出现一次的子序列,输出总个数 State \(1<=n<=2*10^{5}\) \(1<=a[i]<=n\) Input 12 1 2 3
阅读全文
摘要:目录 Description State Input Output Solution Code Description 要求构造一个长度为 \(n\) 的排列,已知排列中最长上升子序列为 \(k\) ,求字典序最小的排列方式 State \(1<=n,k<=2*10^{5}\) \(1<=a[i]<
阅读全文
摘要:目录 Description State Input Output Solution Code Description 计算 \(x^2-y=a\) ,其中 \(a\) 为任意平方数,\(1<=x,y<=n\), 输出答案有多少种 State \(1<=n<=10^{12}\) Input 10 1
阅读全文
摘要:目录 Description State Input Output Solution Code Description 有 \(n\) 个字符串,第 \(i\) 次操作,可以将这 \(n\) 个字符串的第 \(i\%|s|\) 个字符依次发送形成一个新的无限长字符串,在这个新字符串上找到最短区间包含
阅读全文
摘要:目录 Description State Input Output Solution Code Description 有两种操作: \(1 \ L\ R\):对于每个数 \(a[i]=a[i]+lowbit(a[i])\) \(2 \ L\ R\):查询区间 \([L,R]\) 的值 State
阅读全文
摘要:目录 Description State Input Output Solution Code Description 有一个数 \(n\),其中 \(n=\sum_{i=1}^{k}a[i]\),而 \(a[i]\) 的每位数由 \(1,2,3\) 组成,使得 \(k\) 最小 State \(1
阅读全文
摘要:目录 Description State Input Output Solution Code Description 有 \(n\) 个数,表示 \(i\) 想要把礼物送给 \(a[i]\), 问最后最多有几个人可以将礼物送给对的人,不可以将礼物送给自己 State \(1<=t<=10^5\)
阅读全文
摘要:目录 Description State Input Output Solution Code Description 给出一个字符串,定义 \(f(t)=max(next[i]), {\{1<=i<=|t|}\}\), 其中 \(next[]\) 表示 \(kmp\) 算法中的数组; 将 \(t\
阅读全文
摘要:题目描述 You are given 2 arrays a a a and b b b , both of size n n n . You can swap two elements in b b b at most once (or leave it as it is), and you are
阅读全文
摘要:Problem Statement There are N" role="presentation" style="font-size: 114%; position: relative;">NN buildings along the AtCoder Street, numbered 1" rol
阅读全文