Live2d Test Env

随笔分类 -  离线乱搞---莫队&&分块

摘要:题意:给定N个数字,Q次询问,询问这个区间的最大加权众数是多少。 加权众数是指出现次数*数字大小。N,Q<1e5。 思路:不难发现可以N*sqrtN*logN的思路做,但是应该过不了。 这个Nsqrt是莫队的时间,log的支持加入和删除的数据结构的复杂度。 如果用配对堆的话,应该还是比较快的。 没有 阅读全文
posted @ 2019-09-23 20:23 nimphy 阅读(224) 评论(0) 推荐(0) 编辑
摘要:A .DZY Loves Physics 题意:给定带点权和边权的无向图,现在让你选一些点,使得 点权和/被选点对间的边权和 最大。 思路:不难证明,选择边和对应的两点是最优的。 #include<bits/stdc++.h> #define rep(i,a,b) for(int i=a;i<=b; 阅读全文
posted @ 2019-02-27 22:28 nimphy 阅读(520) 评论(0) 推荐(0) 编辑
摘要:ou should process m queries over a set D of strings. Each query is one of three kinds: Note that you should solve the problem in online mode. It means 阅读全文
posted @ 2019-02-24 23:22 nimphy 阅读(276) 评论(0) 推荐(0) 编辑
摘要:B .Aesthetics in poetry 题意:给定N个数,(N<2000 ,a[i] <=1e9),让你找一个最大的K,使得N个数膜K的余数个数全都等于N/K个。 思路:我们找到N的因子,然后验证即可,复杂度O(N^2) #include<bits/stdc++.h> #define rep 阅读全文
posted @ 2019-02-04 19:57 nimphy 阅读(365) 评论(0) 推荐(0) 编辑
摘要:5301: [Cqoi2018]异或序列 Description 已知一个长度为 n 的整数数列 a[1],a[2],…,a[n] ,给定查询参数 l、r ,问在 [l,r] 区间内,有多少连续子 序列满足异或和等于 k 。 也就是说,对于所有的 x,y (l≤x≤y≤r),能够满足a[x]^a[x 阅读全文
posted @ 2018-11-15 17:32 nimphy 阅读(249) 评论(0) 推荐(0) 编辑
摘要:Given you a sequence of number a 1, a 2, ..., a n, which is a permutation of 1...n. You need to answer some queries, each with the following format: G 阅读全文
posted @ 2018-11-05 15:35 nimphy 阅读(322) 评论(0) 推荐(0) 编辑
摘要:There are n n apples on a tree, numbered from 1 1 to n n . Count the number of ways to pick at most m m apples. InputThe first line of the input conta 阅读全文
posted @ 2018-10-23 17:00 nimphy 阅读(510) 评论(0) 推荐(0) 编辑
摘要:题面太丑了,就不复制了。 题意:F1=A; F2=B; Fn=D*Fn-1+C*Fn-2+P/i;求Fn。 思路:根据P/i的值划分区间,每个区间矩阵求。 带常数的矩阵: 阅读全文
posted @ 2018-10-22 09:42 nimphy 阅读(150) 评论(0) 推荐(0) 编辑
摘要:一题题目: 一题题解: 这个题目哪来入门再好不过了,支老板之前没有接触过这个东西,然后一点即通:就是把一个int(32位)拆成32个只放0或1的位置,然后这32个的单点操作或者32个一起操作的复杂度是O(1),所以长度位N的bitset的一次单点操作是O(1),整体操作是O(N/w),其中w=32。 阅读全文
posted @ 2018-03-06 23:06 nimphy 阅读(557) 评论(0) 推荐(0) 编辑
摘要:描述 有n个小朋友需要接水,其中第i个小朋友接水需要ai分钟。 由于水龙头有限,小Hi需要知道如果为第l个到第r个小朋友分配一个水龙头,如何安排他们的接水顺序才能使得他们等待加接水的时间总和最小。 小Hi总共会有m次询问,你能帮助他解决这个问题吗? 假设3个小朋友接水的时间分别是2,3,4。如果他们 阅读全文
posted @ 2018-02-20 14:23 nimphy 阅读(370) 评论(0) 推荐(0) 编辑
摘要:在【乔明达的省选专题】里面有很多这样的解题技巧: 把Σ*Σ类型的题O(n^2)转化∑[n/i]∑[m/i],除法下结果相同的部分合并,复杂度降低至O(√n+√m)。当然论文里的题型应该说说很经典了。这里再积累几个基础题型。 1,求前n个正整数的约数之和,即∑=σ(i) ,(i=1到n)。其中n≤10 阅读全文
posted @ 2018-02-03 10:44 nimphy 阅读(325) 评论(3) 推荐(0) 编辑
摘要:You are given a tree with N nodes. The tree nodes are numbered from 1 to N. Each node has an integer weight. We will ask you to perform the following 阅读全文
posted @ 2018-01-15 10:25 nimphy 阅读(320) 评论(0) 推荐(0) 编辑
摘要:树上的有些问题是可以用树剖或者动态树解决的,但是他们有一个动同点就是:不连通。 比如求u到v的路径权值和,或者最大值: u到v可能对应了多个链,这多个链在对应的数据结构(假设是线段树)上面对应不同的区间。但是线段树上这几个区间的不连续并不影响我们得到答案。 (当然求子树的信息话是连续区间) 那么如果 阅读全文
posted @ 2018-01-12 13:27 nimphy 阅读(3692) 评论(0) 推荐(1) 编辑
摘要:You are given a sequence A[1], A[2], ..., A[N]. (0 ≤ A[i] < 231, 1 ≤ N ≤ 12000). A query is defined as follows: Query(x,y) = Max { a[i] xor a[i+1] xor 阅读全文
posted @ 2018-01-10 11:31 nimphy 阅读(459) 评论(1) 推荐(0) 编辑
摘要:Anton likes permutations, especially he likes to permute their elements. Note that a permutation of n elements is a sequence of numbers {a1, a2, ...,  阅读全文
posted @ 2018-01-05 20:55 nimphy 阅读(440) 评论(0) 推荐(0) 编辑
摘要:Bob has a favorite number k and ai of length n. Now he asks you to answer m queries. Each query is given by a pair li and ri and asks you to count the 阅读全文
posted @ 2018-01-05 17:32 nimphy 阅读(278) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示