- 博客(15)
- 资源 (1)
- 问答 (1)
- 收藏
- 关注
原创 P2839 [国家集训队]middle(可持久化线段树+二分)
题目传送门一个长度为nnn的序列aaa,设其排过序之后为bbb,其中位数定义为b[n/2]b[n/2]b[n/2],其中a,ba,ba,b从000开始标号,除法取下整。给你一个长度为nnn的序列sss。回答QQQ个这样的询问:sss的左端点在[a,b][a,b][a,b]之间,右端点在[c,d][c,d][c,d]之间的子序列中,最大的中位数。其中a<b<c&...
2019-07-11 18:04:09
334
2
原创 CF525E Anya and Cubes
#include <bits/stdc++.h>#include <hash_map>#define MAXN 30#define int long longusing namespace std;inline int read() { int x=0,f=1; char ch=getchar(); while (ch<'0'||ch...
2019-07-11 17:08:10
232
1
原创 CF482B Interesting Array
题面构建一个序列aaa,满足mmm条限制. 限制形如<l,r,q><l,r,q><l,r,q>: a[l]a[l]a[l]&a[l+1]a[l+1]a[l+1]&…&a[r−1]a[r-1]a[r−1]&a[r]=qa[r]=qa[r]=q;(此处’&'为位运算的andandand操作)....
2019-07-11 16:14:11
211
1
原创 FHQ Treap模板
#include <bits/stdc++.h>#define MAXN 500005using namespace std;inline int read() { int x=0,f=1; char ch=getchar(); while (ch<'0'||ch>'9') { if (ch=='-') f=-1; ...
2019-07-10 20:22:20
201
1
原创 SP2916 GSS5 - Can you answer these queries V
题面给定一个序列。查询左端点在[x1,y1][x_1, y_1][x1,y1]之间,且右端点在[x2,y2][x_2, y_2][x2,y2]之间的最大子段和,数据保证x1≤x2,y1≤y2x_1\leq x_2,y_1\leq y_2x1≤x2,y1≤y2 ,但是不保证端点所在的区间不重合题解线段树好题,建议先做SP1043 GSS1 - Can you answer t...
2019-07-10 10:20:32
177
1
原创 SP1043 GSS1 - Can you answer these queries I
线段树每个节点中存的值:val[]val[]val[] ——区间所有数之和lmax[]lmax[]lmax[] ——选的a[i]a[i]a[i]在区间内,且包括a[l]a[l]a[l],连续a[i]a[i]a[i]之和的最大值rmax[]rmax[]rmax[] ——选的a[i]a[i]a[i]在区间内,且包括a[r]a[r]a[r],连续a[i]a[i]a[i]之和的最大值maxn[]m...
2019-07-10 07:50:08
133
原创 CF691E Xor-sequences
可以用矩阵快速幂解决由于k很多,但是我们分析可以看出,dp[k]=dp[k-1] * a(dp[k]和a都是矩阵)(a[i][j]即a[i]^a[j]中二进制1的格式模3是否等于0)dp[1]是什么自己想一想最后求dp[k]的元素之和即可#include <cstdio>#include <iostream>#include <cstring>#...
2019-07-10 07:47:30
268
原创 P2341 [HAOI2006]受欢迎的牛
这道题有可以用暴力水过,不用tarjan思路:将奶牛看成节点,反向建边,对于一只奶牛,跑一边暴力dfs,判断能不能到达其他所有奶牛,然后加一些小小的剪枝就可以过了。//n方过百万,暴力碾标算//我相信:暴力出奇迹 #include <iostream>#include <cstdio>#include <cstring>#include <v...
2019-07-10 07:45:34
109
原创 P1259 黑白棋子的移动
我们先分析一下样例ooooooo*******--oooooo--******o*oooooo******--o*ooooo--*****o*o*ooooo*****--o*o*oooo--****o*o*o*oooo****--o*o*o*ooo--***o*o*o*o*ooo*o**--*o*o*o*o--*o**oo*o*o*o*o*o*o*--o*o*o*o...
2019-07-10 07:44:50
397
原创 CF163D Large Refrigerator
题目描述Vasya wants to buy a new refrigerator. He believes that a refrigerator should be a rectangular parallelepiped with integer edge lengths. Vasya calculated that for daily use he will need a refr...
2019-07-09 22:51:58
308
原创 CF145E Lucky Queries
题目描述Petya loves lucky numbers very much. Everybody knows that lucky numbers are positive integers whose decimal record contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lu...
2019-07-09 21:34:07
281
原创 CF981F Round Marriage
这道题其实可以用暴力水过qwq首先可以知道一个暴力做法如下,具体地来说可以用调整法证明其正确性,但是过不了所有的点。#pragma GCC optimize (2)#pragma G++ optimize (2)#include <algorithm>#include <cstdio>#include <iostream>#include <...
2019-07-09 21:25:08
249
2
原创 CF25E Test
传送门:https://www.luogu.org/problemnew/show/CF25E做法:字符串哈希不过似乎kmpkmpkmp也能做分类讨论两字符串ABA BAB合并的情况:1.BBB为AAA的子串直接枚举BBB在AAA中的位置,哈希判断即可2.AAA为BBB的子串这里由于偷懒,就没写,在暴力枚举时枚举多一些情况3.ABA BAB有相同长度的前缀和后缀枚举前...
2019-07-09 21:19:27
237
1
原创 CF1006F Xor-Paths
传送门:https://www.luogu.org/problemnew/show/CF1006F双向搜索,Map[x][y][n]Map[x][y][n]Map[x][y][n]表示搜索到(x,y)(x,y)(x,y)异或和为n有多少种方法。还要利用异或的性质:(a^b)^b=a记得开long long#include <bits/stdc++.h>#include &...
2019-07-09 20:09:50
262
1
原创 CF280D k-Maximum Subsequence Sum(线段树)
传送门:https://www.luogu.org/problemnew/show/CF280D题面大意:长度为nnn的数列,支持两种操作:1.修改某个位置的值2.询问区间[l,r][l,r][l,r]里选出至多kkk个不相交的子段和的最大值。 一共有mmm个操作解法:暴力dpdpdp+滚动数组(在本地卡进2s)模拟赛的时候有人用这个方法A了#include <bits/st...
2019-07-09 20:02:16
382
2
curl和Chrome查看网页源代码结果不一样?
2020-07-04
TA创建的收藏夹 TA关注的收藏夹
TA关注的人