随笔分类 - 数据结构---线段树
摘要:题目:https://www.luogu.org/problemnew/show/P2221 题意:有n个节点排成一条链,相邻节点之间有一条路。 C u v val表示从u到v的路径上的每条边权值都加val。 Q l r表示在l到r中等概率选择两个城市的路径长度的期望值。 思路:首先期望值的分子肯定
阅读全文
摘要:Cleaning Shifts Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 32561 Accepted: 7972 Description Farmer John is assigning some of his N (1
阅读全文
摘要:Cleaning Shifts Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 4422 Accepted: 1482 Description Farmer John's cows, pampered since birth, h
阅读全文
摘要:You ye Jiu yuan is the daughter of the Great GOD Emancipator. And when she becomes an adult, she will be queen of Tusikur, so she wanted to travel the
阅读全文
摘要:There's a beach in the first quadrant. And from time to time, there are sea waves. A wave ( xx , yy ) means the wave is a rectangle whose vertexes are
阅读全文
摘要:Ryuji is not a good student, and he doesn't want to study. But there are n books he should learn, each book has its knowledge a[i]a[i]. Unfortunately,
阅读全文
摘要:During tea-drinking, princess, amongst other things, asked why has such a good-natured and cute Dragon imprisoned Lpl in the Castle? D...
阅读全文
摘要:Alice is so popular that she can receive many flowers everyday. She has N vases numbered from 0 to N-1. When she receive some flowers,...
阅读全文
摘要:Yuanfang is puzzled with the question below: There are n integers, a 1, a 2, …, a n. The initial values of them are 0. There are four ...
阅读全文
摘要:There is a company that has N employees(numbered from 1 to N),every employee in the company has a immediate boss (except for the leade...
阅读全文
摘要:During the War of Resistance Against Japan, tunnel warfare was carried out extensively in the vast areas of north China Plain. General...
阅读全文
摘要:A lot of battleships of evil are arranged in a line before the battle. Our commander decides to use our secret weapon to eliminate the...
阅读全文
摘要:For the daily milking, Farmer John's N cows (1 ≤ N ≤ 50,000) always line up in the same order. One day Farmer John decides to organize...
阅读全文
摘要:You have N integers, A1, A2, ... , AN. You need to deal with two kinds of operations. One type of operation is to add some given numbe...
阅读全文
摘要:很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。 这让很多学生很反感。 不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。Input本题目包含多组测试,请处理到文...
阅读全文
摘要:C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚...
阅读全文
摘要:省赛主席树模板题和zyn大佬想了两个小时没想出来 太菜了太菜了 要是我能强到和HJT大神一样能在考场上想出一个主席树一样的东西就好了哈哈哈 感觉主席树就是一个线段树加前缀和加一个优化 主要用于求区间第k小的问题 如果区间是固定的 用线段树或者是归并都好求 用线段树的话 每个节点就存这个区间有的数的个
阅读全文
摘要:SnacksTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 4446 Accepted Submis...
阅读全文
摘要:The citizens of Bytetown, AB, could not stand that the candidates in the mayoral election campaign have been placing their electoral posters at all pl
阅读全文