标签 - 线段树

? 解题记录 ? ? Topcoder ? ? 线段树 ? ? 动态规划 ? ? 搜索 ?    2019-02-25 07:59:43    306    0    0
Easy MostFrequentLastDigit 题意:构造一个长为n" role="presentation" style="position: relative;">nnn的数列,满足两两的和mod 10" role="presentation" style="position: relative;">mod 10mod 10mod\ 10为d" role="presentation" style="position: relative;">ddd的整数对唯一最多,不能有一样多的。要求每个数都不一样,不超过109" role="
? 解题记录 ? ? Atcoder ? ? 线段树 ? ? 组合数 ? ? 贪心 ? ? 动态规划 ?    2019-02-16 15:14:38    586    0    0
A Two Abbreviations 签到题,就不翻译了 找两个串一段长度的gcd" role="presentation" style="position: relative;">gcdgcdgcd,判一判对应位置一不一样就可以了。 B Removing Blocks 题意:给你一个长度为N" role="presentation" style="position: relative;">NNN的序列,将N" role="presentation" style="position: relative;">NNN个数依次删掉。每一次删掉一个数的代价是这个数
? 解题记录 ? ? 洛谷 ? ? 线段树 ?    2018-10-09 08:42:56    374    0    0
Sylvia是一个热爱学习的女孩子。 前段时间,Sylvia参加了学校的军训。众所周知,军训的时候需要站方阵。 Sylvia所在的方阵中有 n×m" data-mce-tabindex="0">n×m 名学生,方阵的行数为 n" data-mce-tabindex="0">n,列数为 m" data-mce-tabindex="0">m。 为了便于管理,教官在训练开始时,按照从前到后,从左到右的顺序给方阵中的学生从 1" data-mce-tabindex="0">1 到 n&a
? 解题记录 ? ? LOJ ? ? 线段树 ? ? 二分答案 ? ? stl ?    2018-10-02 15:05:34    809    0    0
地址:https://loj.ac/problem/2585 说一说我和这道题的故事吧。APIO2018现场:和moonzero在一个考室,前一天才好不容易会使用linux系统后一天就要上考场了,非常的方。打开problems,首先映入眼帘的便是 A.新家。毫不犹豫先打了5分暴力,然后去打了T3,T2的暴力。回头来准备肝T1,发现自己会Subtask2的7分暴力。然后死也没调出来,400个set把自己送胸牌了。下来moonzero告诉我他更窒息,写了400个splay………………嗯,叙旧就叙到这里了,前几天又想起这道题,发现有了思路。接下来我们来看看APIO这道亲民的码农题的做法吧。首先我们容
? 解题记录 ? ? BZOJ ? ? 并查集 ? ? 线段树 ? ? Kruscal ?    2018-09-25 08:06:17    342    0    0
Description在Byteland一共有n个城市,编号依次为1到n,它们之间计划修建m条双向道路,其中修建第i条道路的费用为ci。B yteasar作为Byteland公路建设项目的总工程师,他决定选定一个区间[l,r],仅使用编号在该区间内的道路。他希 望选择一些道路去修建,使得连通块的个数尽量少,同时,他不喜欢修建多余的道路,因此每个连通块都可以看成 一棵树的结构。为了选出最佳的区间, Byteasar会不断选择 q个区间,请写一个程序,帮助 Byteasar计算每个区 间内修建公路的最小总费用。  Input第一行包含三个正整数n; m; q,表示城市数、道路数和询问数
【题目描述】给定一棵n个点的有根树,编号依次为1到n,其中1号点是根节点。每个节点都被染上了某一种颜色,其中第i个节点的颜色为c[i]。如果c[i]=c[j],那么我们认为点i和点j拥有相同的颜色。定义depth[i]为i节点与根节点的距离,为了方便起见,你可以认为树上相邻的两个点之间的距离为1。站在这棵色彩斑斓的树前面,你将面临m个问题。 每个问题包含两个整数x和d,表示询问x子树里且depth不超过depth[x]+d的所有点中出现了多少种本质不同的颜色。请写一个程序,快速回答这些询问。 【输入】第一行包含一个正整数T(1<=T<=500),表示测试数据的组数。 每组数据中,第
Bomboslav set up a branding agency and now helps companies to create new logos and advertising slogans. In term of this problems, slogan of the company should be a non-empty substring of its name. For example, if the company name is "hornsandhoofs", then substrings "sand" and "hor" could b
? 解题记录 ? ? Atcoder ? ? 线段树 ?    2018-07-13 22:38:40    805    0    0
Problem StatementWe have a sequence A of length N. On this sequence, we can perform the following two kinds of operations: Swap two adjacent elements. Select one element, and increment it by 1. We will repeatedly perform these operations so that A will be a non-decreasi
? 解题记录 ? ? 洛谷 ? ? 线段树 ?    2018-07-05 23:15:03    666    0    0
一条东西走向的穆西河将巴邻旁市一分为二,分割成了区域 A" data-mce-tabindex="0">AA 和区域 B" data-mce-tabindex="0">BB。 每一块区域沿着河岸都建了恰好 1000000001" data-mce-tabindex="0">10000000011000000001 栋的建筑,每条岸边的建筑都从 0" data-mce-tabindex="0">00 编号到 1000000000" data-mce-tabindex="0">100000
? 解题记录 ? ? 洛谷 ? ? 线段树 ? ? 哈希 ?    2018-06-25 20:28:33    478    0    0
题目描述The Trains of Colour Parade begins tomorrow in Byteotia. Intense preparations are already in progress at the station's auxiliary tracks. There are nn parallel tracks at the station, numbered from 11 to nn . The train no. ii occupies the i^{th}ith