随笔分类 - 数据结构—线段树树状数组
摘要:A. R 链接:https://ac.nowcoder.com/acm/contest/23479/A 来源:牛客网 题目描述 小红拿到了一个长度为 nn 的字符串,该字符串仅由大写字母组成。 小红很喜欢红色(用'R'字母表示),但她非常讨厌紫色(用'P'字母表示)。 她想取一个连续子串,该子串包含
阅读全文
摘要:A. ABC 签到,不解释 #include <iostream> #include <vector> using namespace std; int main() { int t; cin >> t; while(t--) { string s; int n; cin >> n; cin >>
阅读全文
摘要:很久没做题,赛时A了9道加起来WA了16发...剩下三道待补 A. 九小时九个人九扇门 链接:https://ac.nowcoder.com/acm/contest/23106/A 来源:牛客网 题目描述 在打越钢太郎的著名解谜游戏系列《极限脱出》的第一作《九小时九个人九扇门》中,有这样一个有趣的设
阅读全文
摘要:链接:https://ac.nowcoder.com/acm/contest/22352/I 来源:牛客网 题目描述 阿强采摘了一些苹果,并把他们分堆排成了一行,从左往右编号为第 1 … 𝑛 堆,其中第𝑖堆苹果有aiai个。 完美主义者阿珍看到这些苹果,觉得他们摆放的非常杂乱。她要求阿强进行如下
阅读全文
摘要:链接:https://ac.nowcoder.com/acm/contest/11216/G 来源:牛客网 题目描述 想去实现宏大的梦想 向着那遥不可及的地方 想在那一片纯白的世界 留下我最初的脚印 在世界的终端 太阳在永不停息地运转 南风终将吹过小岛 轻抚我的柔发 想去实现心底小小的梦 ——《ハル
阅读全文
摘要:Moamen was drawing a grid of 𝑛n rows and 109109 columns containing only digits 00 and 11. Ezzat noticed what Moamen was drawing and became interested
阅读全文
摘要:链接:https://ac.nowcoder.com/acm/contest/11260/E 来源:牛客网 题目描述 There are n cities in the volcano country, numbered from 1 to n. The city 1 is the capital
阅读全文
摘要:Problem Description As an elegant and accomplished girl, Bella loves watching stars at night (especially the Polaris). There are totally n stars in th
阅读全文
摘要:链接:https://ac.nowcoder.com/acm/contest/11257/H 来源:牛客网 题目描述 Little Rabbit loves hopping. He always hops around on the grassland. But dangers are lurkin
阅读全文
摘要:题目描述 Petr likes to come up with problems about randomly generated data. This time problem is about random permutation. He decided to generate a random
阅读全文
摘要:Problem Description One day, a zombie came to the Lawn of the Dead, which can be seen as an n×m grid. Initially, he stood on the top-left cell, which
阅读全文
摘要:Problem Description Kanade is designing a mini-game. It's a puzzle game that orders players to get out of a maze. Players should also collect as many
阅读全文
摘要:链接:https://ac.nowcoder.com/acm/contest/11255/E 来源:牛客网 题目描述 Bob has a tree with nn nodes and the weight of i-th node is wiwi. But Bob forgot w1...nw1..
阅读全文
摘要:链接:https://ac.nowcoder.com/acm/contest/11255/I 来源:牛客网 题目描述 For a sequence t1...nt1...n, we define the weight of it is the number of pairs (i,j)(i,j) s
阅读全文
摘要:Kobolds are rat-like, candle-loving cave folk, digging deep beneath the surface for millennia. Today, they gather together in a queue to explore yet a
阅读全文
摘要:Little Q is very sleepy, and he really needs some coffee to make him awake. At this time, Little L brings a pot to Little Q, and he states the pot as
阅读全文
摘要:链接:https://ac.nowcoder.com/acm/contest/11171/B 来源:牛客网 小 Q 的院子里种了 n朵彼岸花,其中第 i 朵的彼岸花的美丽值为 ai,彼岸花按照编号从小到大从左向右排成了一排。 现在小 Q 有 m 个问题,他每次会给出一个区间 [l,r][l,r],他
阅读全文
摘要:题目描述 在数轴上有 n个闭区间从 1 至 n 编号,第 i 个闭区间为 [li,ri][l**i,r**i] 。 现在要从中选出 m 个区间,使得这 m 个区间共同包含至少一个位置。换句话说,就是使得存在一个 x ,使得对于每一个被选中的区间 [li,ri][l**i,r**i],都有 li≤x≤
阅读全文
摘要:链接:https://ac.nowcoder.com/acm/contest/1033/B 来源:牛客网 题目描述 给定一个长度为N的数列A,以及M条指令,每条指令可能是以下两种之一: 1、“C l r d”,表示把 A[l],A[l+1],…,A[r] 都加上 d。 2、“Q l r”,表示询问
阅读全文
摘要:n 个小朋友站成一排。 现在要把他们按身高从低到高的顺序排列,但是每次只能交换位置相邻的两个小朋友。 每个小朋友都有一个不高兴的程度。 开始的时候,所有小朋友的不高兴程度都是 0。 如果某个小朋友第一次被要求交换,则他的不高兴程度增加 1,如果第二次要求他交换,则他的不高兴程度增加 2(即不高兴程度
阅读全文