自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(319)
  • 收藏
  • 关注

原创 模板整理 慢慢更新

矩阵快速幂斐波那契第n项和#include <bits/stdc++.h>using namespace std;#define ne 2#define INF 1000000009struct node{ long long a[ne][ne];};node mult(node a, node b){ node c = {0}; ...

2018-04-25 19:57:51 266

原创 2021-08-17 一步步学习扫描线

扫描线学习简介¶扫描线一般运用在图形上面,它和它的字面意思十分相似,就是一条线在整个图上扫来扫去,它一般被用来解决图形面积,周长等问题。https://www.luogu.com.cn/problem/P5490https://oi-wiki.org/geometry/scanning/简单来讲 这个问题先用最简单的方法解决。这个也是扫描线的解决方法优化就是把线的更新和查询替换成线段树。#include<iostream>#include <map>#include

2021-08-18 20:45:24 193

原创 clion file and code templates

主要用于 文件命名为 my_class 时 生成的类为 MyClassc++ class header"- 和 | " 都是被分割的对象#parse("C File Header.h")#[[#ifndef]]# ${INCLUDE_GUARD}#[[#define]]# ${INCLUDE_GUARD}${NAMESPACES_OPEN} #set( $CamelCaseName = "" )#set( $part = "" )#foreach($part in $NAME.spli

2021-06-20 01:37:07 432

原创 拉格朗日插值

直接上公式简单的讲 ,这个玩意就是在给你若干个 f(xi) = yi 的结果 算出f(k) 的结果//最朴素的实现方法 验证下这个公式的结果 #include <bits/stdc++.h>using namespace std;int main(){ int n; //输入n 个点的坐标 cin>>n; vector< pair<double ,double > > node; for(int i =

2021-06-17 16:08:32 151

原创 c++ 计算器 语法实现

#include <bits/stdc++.h>using namespace std;//语法逻辑//exp: factor//| exp '+' factor//| exp '-' factor//;////factor: term//| factor '*' term//| factor '/' term//;////term: NUMBER//| '(' exp ')'//| '-' term//| '+' term//;//%%int str_

2021-06-16 18:28:58 162

原创 Codeforces Round #715 (Div. 2)

http://codeforces.com/contest/1509E. Almost Sorted1 _ 2 _ 3 _ 4 _ 5 _ 6这六个数字中有五个板子 。每个板子可以为1 或者为 0 。00001 = 1 2 3 4 6 500011 = 1 2 3 6 5 4然后翻转连续为1的区间即可。翻转连续的区间可以保证 a[i+1]>= a[i] - 1.下面是插板法的证明#include <bits/stdc++.h>using namespace std;

2021-06-03 18:02:45 67

原创 蓝桥杯-第九届决赛——版本分支 已过 含题目链接

蓝桥杯-第九届决赛——版本分支题目链接 http://oj.ecustacm.cn/problem.php?id=1400网上一堆扯淡的代码 都不过查询是自下而上的,所以本质上是如何往上跳的最快。本质上内存够大,树上的每个位置把祖先节点都存一遍就能o1查询了,但是内存不够,所以需要加速这个跳跃查询。 脑壳仔细一想就可以分治查询,即每次向上走根号个位置,然后最后再逐步挪动。 之后超时了 ,那么就每次先向上走一半位置 ,然后走根号位置 ,之后逐步挪动就过了。组合算法。复杂度低于 log(n)+sqrt(

2020-12-04 16:36:07 262

原创 赶火车

赶火车Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 982 Accepted Submission(s): 255Problem Description小伙伴们愉快地结束了暑假wannafly训练营的生活,决定返回学校,早上...

2019-04-12 14:30:46 279 1

原创 Codeforces Round #547 (Div. 3)

https://codeforces.com/contest/1141/problem/B#include <bits/stdc++.h>using namespace std;const int maxn = 2e5 + 5;int a[maxn],b[maxn];int main(){ int n; while ( cin >> n ) ...

2019-03-21 18:01:21 150

原创 牛客小白月赛12

https://ac.nowcoder.com/acm/contest/392#question文章目录A 华华听月月唱歌B 华华教月月做数学C 华华给月月出题E 华华给月月准备礼物I 华华和月月逛公园J 月月查华华的手机A 华华听月月唱歌排序,然后贪心处理。设一个y每次 当第一个l &lt;= y+1 的时候 那么这行 r 的这个值,就是可能替换y 的值,所以我们就找满足这个条件的...

2019-03-11 20:10:23 308

原创 Codeforces Round #545 (Div. 2)

https://codeforces.com/contest/1138https://codeforces.com/contest/1138/problem/C题意:注意一点,是去寻找这一行,和这一列,行和列是单独的。比如例子中,是因为横行确定为3了之后,所以上面的20才是4,4和 3所在和横行没有关系。读题也是实力的一部分题解;对每一行每一列进行离散化。然后,取行列的最大值,和行...

2019-03-09 16:00:47 356

原创 Codeforces Round #410 (Div. 2)

https://codeforces.com/contest/798https://codeforces.com/contest/798/problem/E题意:排列p,编码了一个序列a。对于每个i,找到第一个pj&amp;gt;pi并且未被标记的j,标记这个j并a[i]=j。给出a求一个可行的p,保证有解。n≤500000思路:仔细想了一个多小时,思路是这样的,在原图中有两种关系。第一种:...

2019-03-08 20:23:46 176

原创 Codeforces Round #452 (Div. 2)

http://codeforces.com/contest/899http://codeforces.com/contest/899/problem/A题意:给出一串数字,只有1 和 2 ,然后三人一组才能比赛。之后 是 ,两个人的必须全部参赛题解:按照题意模拟即可#include &lt;bits/stdc++.h&gt;using namespace std;const ...

2019-03-05 22:51:52 125

原创 Codeforces Round #451 (Div. 2)

https://codeforces.com/contest/898A:题意;给出一个数字 ,四舍五入一下。题解 :四舍五入#include&amp;amp;amp;lt;bits/stdc++.h&amp;amp;amp;gt;using namespace std;const int maxn=1e5+5;int main(){ int n; while(cin&amp;amp;amp;gt;&amp;amp;amp;gt;n)

2019-03-01 16:14:14 142

原创 Codeforces Round #450 (Div. 2)

https://codeforces.com/contest/900https://codeforces.com/contest/900/problem/A题意:一堆坐标点,删除一个点后,剩余的点是不是在y轴的一边题解:寻找一个与众不同的点,就是x轴唯一为负数或者为正数的点;或者随意删除一个点就行;#include &lt;bits/stdc++.h&gt;using names...

2019-03-01 11:23:20 104

原创 Codeforces Round #448 (Div. 2)

https://codeforces.com/contest/895/problem/C题意:一个集合选出一个子集 他们的乘积是一个平方数问又多少个这样的集合题解:数的范围只有70,可以将其素因子状压一下,平方数只与质因子的奇偶性有关,dp[i][j]表示前i个数j状态的方案数。#include&amp;lt;bits/stdc++.h&amp;gt;using namespace std;#d...

2019-02-28 10:46:55 151

原创 Codeforces Round #299 (Div. 2)

https://codeforces.com/contest/535https://codeforces.com/contest/535/problem/A题意 ;输入一个数字,输出一个英文数字。题解:-打表啊什么的#include &amp;lt;bits/stdc++.h&amp;gt;using namespace std;#define INF 100000000#define F...

2019-02-26 13:15:59 125

转载 git的命令记录

git status //查看当前库状态git add //添加文件git commit -m “” //上传说明git reset --hard HEAD^ //回退到上个版本git diff &amp;amp;lt;file&amp;amp;gt; //修改了啥cat &amp;amp;lt;file &amp;amp;gt; //读取文件git reset --hard &amp;amp;lt;hash&amp;amp;gt

2019-02-22 17:55:42 129

原创 Codeforces Round #520 (Div. 2)

https://codeforces.com/contest/1062https://codeforces.com/contest/1062/problem/B题意 :给一个数字n有两种操作n 乘上任意一个数字n变成根号n (根号n必须是整数, 就是 n必须是某个数字的平方)然后 问n能变成最小值的最少操作题解:把n进行质因数分解 ,并且数每个质因数的数量然后检查最大次幂...

2019-02-22 14:16:49 157

原创 Codeforces Round #499 (Div. 2)

这个应该是我做过最舒爽的一套cf了 -https://codeforces.com/contest/1011大意:火箭有n个部件(种类为’a’-‘z’,'a’的重量为1,依次递增),需要从中选出k个部件组成一个火箭,满足对于每个部件,其后方的部件重量至少比其大2,求满足该条件的火箭的最小重量,若不存在则输出-1。(1&lt;=k&lt;=n&lt;=50)题解 :水题 排序 寻找间隔大于2...

2019-02-22 10:36:27 106

原创 Codeforces Round #455 (Div. 2)

https://codeforces.com/contest/909题意:给定两个用空格分隔的字符串,分别取两字符串的任意非空前缀,将两前缀合并为一个新的字符串,求可行字典序最小的字符串。题解:枚举字符串寻找i最小串#include &lt;bits/stdc++.h&gt;#define maxn 10001using namespace std;string s,ss;int...

2019-02-21 17:41:15 159

原创 三维方块切割

垃圾版三维切割 待完善#include &lt;bits/stdc++.h&gt;using namespace std;typedef pair&lt;int, int &gt; pr;typedef queue&lt;pr&gt; QP;#define mk make_pair#define random(x) (rand()%x+1)typedef vector&lt;int...

2019-02-21 16:27:52 272

原创 Educational Codeforces Round 57 (Rated for Div. 2)

https://codeforces.com/contest/1096/problem/B题解:比如aacdeee如果我们想保留左边的a 话 那么需要删除的是aa后面的所有,以及一个a, 连续的a 的长度为2 可删除的为 cdeee acdeee 两种如果想保留右边e的话 那么要删除的是右边aacd 然后 和两个e 一共三种删除方法。所以左右不等于的时候 删除方法就很明显了 ...

2019-02-21 10:03:35 92

原创 CodeCraft-19 and Codeforces Round #537 (Div. 2)

https://codeforces.com/contest/1111https://codeforces.com/contest/1111/problem/A#include &amp;lt;bits/stdc++.h&amp;gt;using namespace std;int check(char a){ if (a == 'a' || a == 'i' || a == 'e' || a ...

2019-02-19 20:08:12 109

原创 Codeforces Round #511 (Div. 2)

https://codeforces.com/contest/1047/problem/A判断下n-2 是不是3的倍数如果是 那么第二个数是2#include &lt;bits/stdc++.h&gt;using std::cout;using std::endl;int main(){ int n; std::cin&gt;&gt;n; cout&lt;...

2019-02-19 14:48:09 72

原创 Codeforces Round #536 (Div. 2)

https://codeforces.com/contest/1106/problem/A每次选取一个‘x’ 判断四角是不是’x’#include &amp;amp;amp;lt;iostream&amp;amp;amp;gt;#include &amp;amp;amp;lt;fstream&amp;amp;amp;gt;using namespace std;char matr[505][505];bool check(int x,int y){

2019-02-17 16:16:00 105

原创 Codeforces Round #536 (Div. 2)

https://codeforces.com/contest/1106/problem/A每次选取一个‘x’ 判断四角是不是’x’#include &lt;iostream&gt;#include &lt;fstream&gt;using namespace std;char matr[505][505];bool check(int x,int y){ for(int i=...

2019-02-17 16:16:00 97

原创 cf刷题日记 1.28 ~2.1

文章目录Codeforces Round #530 (Div. 2)F. CookiesCodeforces Round #530 (Div. 2)F. Cookieshttps://codeforces.com/contest/1099/problem/F题意:给你一棵树,每个节点上有若干饼干,并且给出每个节点上吃一块饼干需要多少时间,同时给出走过一条边所需时间。总时限为 TT,两个人...

2019-01-29 15:36:17 280

原创 cf刷题日记 2019 .1.21~~2019.1.25

文章目录Codeforces Round #533 (Div. 2) C. Ayoub and Lost Array &amp;DPCodeforces Round #533 (Div. 2) D. Kilani and the Game标题 532 div2 F. Ivan and Burgers 线性基标题 Educational Codeforces Round 58 (Rated...

2019-01-25 15:56:23 247

原创 Hello 2019

http://codeforces.com/contest/1097/problem/C题意:给出一堆串,问有多少对合法的串。括号匹配解法: 判定一个串是不是只多出一种括号的串,记录数量,然后两个数组分别记录左右两种括号。最后加起来#include &amp;amp;amp;lt;bits/stdc++.h&amp;amp;amp;gt;using namespace std;int tag[500005],tage[500005];...

2019-01-09 09:29:10 277

原创 poj 3279

http://poj.org/problem?id=3279只需要枚举第一行的2^n次方的踩踏方式 之后遍历全图 ,如果b[i-1][j] 没有被反转 那么点(i,j) 则需要反转。 以此搜索出所有可能性 然后选择最小的。 全排列按照字典序从小到大开始排列 代码总体分为三个函数 全排列函数寻找首行全排列 遍历函数计算 反转函数反转相邻六个点。总体纯暴力#incl...

2018-03-30 14:23:52 215

原创 白书16.12凸包

http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_4_A安德鲁算法 安德鲁算法判断凸包需要用到叉积 关于叉积首先在二维坐标下介绍一些定义:点:A(x1,y1),B(x2,y2)向量:向量AB=( x2 - x1 , y2 - y1 )= ( x , y );向量的模 |AB| = sqrt ( ...

2018-03-26 16:24:02 191

原创 蓝桥杯 历届试题 网络寻路

历届试题 网络寻路  时间限制:1.0s   内存限制:256.0MB      问题描述X 国的一个网络使用若干条线路连接若干个节点。节点间的通信是双向的。某重要数据包,为了安全起见,必须恰好被转发两次到达目的地。该包可能在任意一个节点产生,我们需要知道该网络中一共有多少种不同的转发路径。源地址和目标地址可以相同,但中间节点必须不同。如

2017-12-29 09:25:53 398

原创 hiho #1394 : 网络流四·最小路径覆盖

#1394 : 网络流四·最小路径覆盖时间限制:10000ms单点时限:1000ms内存限制:256MB描述国庆期间正是旅游和游玩的高峰期。小Hi和小Ho的学习小组为了研究课题,决定趁此机会派出若干个调查团去沿途查看一下H市内各个景点的游客情况。H市一共有N个旅游景点(编号1..N),由M条单向游览路线连接。在一个景点游览完后

2017-12-11 10:33:31 219

原创 Ural 1018 Binary Apple Tree

超级暴力的树 。m^3的复杂度 。对每个树的左右两个孩子进行组合。组合的为左边1——m 个边和右边1——m个边  然后求出以此个节点为父节点时 保存边数等于1 到m 的分别的最大值 。#include using namespace std;#define mo 105#define pus push_backstruct node{

2017-10-31 20:14:52 262

原创 dinic 模板 待补充

#include using namespace std;#define mk make_pair#define pus push_back#define mo 1005vector > d[mo];vector > de[mo];int tag[mo];int dfs(int node,int low,int n){ // cout<<node<<endl;

2017-10-21 10:51:26 232

原创 Engineer Assignment dp

状压dp 。学习的时候唯一的疑问就是不知道怎么转换状态 。还是因为对状态压缩不是多么懂刷了这个题就好多了  。把能完成 第i 个任务的状态进行记录 。之后用这个状态进行dp最好用的就是二进制 。1代表选过  0代表没选过  。在这个上面进行状态压缩 。代码注释下看  #include using namespace std;#define m

2017-10-19 20:57:29 249

原创 Problem I. Mr. Panda and Crystal

搜索加背包 。#include using namespace std;#define mk make_pair#define pus push_backvector > de[205][205];int dej[205];int be[205];int bj[205];int jl[205];int dp[10005];int s,n,m;struct node{

2017-10-19 09:29:52 316

原创 poj 1741 洛谷 3806 【模板】点分治1 树的分治 点分治

题目背景感谢hzwer的点分治互测。题目描述给定一棵有n个点的树询问树上距离为k的点对是否存在。输入输出格式输入格式:n,m 接下来n-1条边a,b,c描述a到b有一条长度为c的路径接下来m行每行询问一个K输出格式:对于每个K每行输出一个答案,存在输出“AYE”,否则输出”NAY”(不包含引号)输入输出样例输入样例#1:2 11 2 22输出样例#1:AYEhttps://www.luogu....

2017-10-17 10:35:53 347

原创 poj 1741 洛谷 3806 【模板】点分治1 树的分治 点分治

Tree Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 24713 Accepted: 8256 DescriptionGive a tree with n vertices,each edge has a length(positive integer less than 1001). Define dist(u

2017-10-17 10:24:03 328

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除