自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

转载 洛谷 P3369 【模板】普通平衡树 (Treap)

题目链接:P3369 【模板】普通平衡树题意构造一种数据结构满足给出的 6 种操作。思路平衡树平衡树的模板题。先学习了一下 Treap。模板来自《算法竞赛进阶指南》。代码#include <bits/stdc++.h>using namespace std;const int maxn = 1e5 + 10;const int inf = 0x3f3f...

2019-09-25 22:37:00 220

转载 SPOJ MAXMATCH - Maximum Self-Matching (FFT)

题目链接:MAXMATCH - Maximum Self-MatchingDescriptionYou're given a string s consisting of letters 'a', 'b' and 'c'.The matching function \(m_s( i )\) is defined as the number of matching characte...

2019-09-24 23:34:00 267

转载 洛谷 P4173 残缺的字符串 (FFT)

题目链接:P4173 残缺的字符串题意给定长度为 \(m\) 的模式串和长度为 \(n\) 的目标串,两个串都带有通配符,求所有匹配的位置。思路FFT带有通配符的字符串匹配问题。设模式串为 \(p\),目标串为 \(t\),将两个串的内容都根据字母先后顺序映射到 \(1\) 到 \(26\)。如果不带有通配符,那么 \(t\) 以第 \(k\) 位结束的长度为 \(|p|\...

2019-09-23 22:25:00 233

转载 Codeforces 993E Nikita and Order Statistics (FFT)

Codeforces Round #488 by NEAR (Div. 1)题目链接:Nikita and Order StatisticsCF993E Nikita and Order StatisticsNikita likes tasks on order statistics, for example, he can easily find the \(k\)-th n...

2019-09-22 15:53:00 257

转载 洛谷 P2756 飞行员配对方案问题 (二分图匹配)

题目链接:P2756 飞行员配对方案问题题意给定 \(m\) 个外籍飞行员和 \(n - m\) 个英国飞行员,每一架飞机需要一名英国飞行员和一名外籍飞行员,求最多能派出几架飞机。思路最大流二分图最大匹配的模板题。建立一个超级源点 \(s\) 和一个超级汇点 \(t\)。让 \(s\) 与所有的外籍飞行员建立有向边,所有的英国飞行员与 \(t\) 建立有向边。让所有边的容量为...

2019-09-21 23:10:00 237

转载 HDU 1879 继续畅通工程 (最小生成树)

题目链接:HDU 1879Problem Description省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可)。现得到城镇道路统计表,表中列出了任意两城镇间修建道路的费用,以及该道路是否已经修通的状态。现请你编写程序,计算出全省畅通需要的最低成本。Input测试输入包含若干测试用例。每个测试用例的第1...

2019-09-20 23:32:00 114

转载 POJ 3090 Visible Lattice Points (欧拉函数)

题目链接:POJ 3090DescriptionA lattice point \((x, y)\) in the first quadrant (\(x\) and \(y\) are integers greater than or equal to \(0\)), other than the origin, is visible from the origin if the...

2019-09-19 19:54:00 98

转载 SPOJ VFMUL - Very Fast Multiplication (FFT)

题目链接:VFMUL - Very Fast MultiplicationDescriptionMultiply the given numbers.Inputn [the number of multiplications <= 101]l1 l2 [numbers to multiply (at most 300000 decimal digits each)]...

2019-09-18 21:19:00 199

转载 洛谷 P3803 【模板】多项式乘法(FFT)

题目链接:P3803 【模板】多项式乘法(FFT)题意给定一个 \(n\) 次多项式 \(F(x)\) 和一个 \(m\) 次多项式 \(G(x)\),求 \(F(x)\) 和 \(G(x)\) 的卷积。思路FFT又是一道 \(FFT\) 的模板题,不过用递归的 \(FFT\) 会超时。代码#include <bits/stdc++.h>using names...

2019-09-17 22:45:00 247

转载 洛谷 P1919 【模板】A*B Problem升级版(FFT快速傅里叶)

题目链接:P1919 【模板】A*B Problem升级版(FFT快速傅里叶)题意给定两个 \(n\) 位 \(10\) 进制整数 \(x\) 和 \(y\),求 \(x*y\)。思路FFT\(FFT\) 的模板题,好像也可以直接用高精度乘法做。代码#include <bits/stdc++.h>using namespace std;const doubl...

2019-09-16 22:03:00 274

转载 2019 ACM-ICPC 上海网络赛 B. Light bulbs (差分)

题目链接:Light bulbs比赛链接:The Preliminary Contest for ICPC Asia Shanghai 2019题意给定 \(N\) 个灯泡 (编号从 \(0\) 到 \(N - 1\)),初始都是关闭的。给定 \(M\) 个操作,每个操作包含 \(L\) 和 \(R\),对 \([L, R]\) 内的所有灯泡改变状态。求最后有几个灯泡是亮的。...

2019-09-15 22:43:00 172

转载 POJ 1474 Video Surveillance (半平面交)

题目链接:POJ 1474DescriptionA friend of yours has taken the job of security officer at the Star-Buy Company, a famous depart- ment store. One of his tasks is to install a video surveillance system...

2019-09-14 18:58:00 158

转载 HDU 5119 Happy Matt Friends (背包DP + 滚动数组)

题目链接:HDU 5119Problem DescriptionMatt has N friends. They are playing a game together.Each of Matt’s friends has a magic number. In the game, Matt selects some (could be zero) of his friends. ...

2019-09-13 23:37:00 142

转载 洛谷 P1613 跑路 (倍增 + DP + 最短路)

题目链接:P1613 跑路题意给定包含 \(n\) 个点和 \(m\) 条边的有向图,每条边的长度为 \(1\) 千米。每秒钟可以跑 \(2^k\) 千米,问从点 \(1\) 到点 \(n\) 最少需几秒。思路倍增 DP Floyd令 \(dp[i][j][k]\) 表示从 \(i\) 到 \(j\) 是否存在长度为 \(2^k\) 的路径。那么如果 \(dp[i][t][k...

2019-09-12 23:00:00 142

转载 POJ 1279 Art Gallery (半平面交)

题目链接:POJ 1279Problem DescriptionThe art galleries of the new and very futuristic building of the Center for Balkan Cooperation have the form of polygons (not necessarily convex). When a big ex...

2019-09-11 18:28:00 186

转载 POJ 3130 How I Mathematician Wonder What You Are! (半平面交)

题目链接:POJ 3130Problem DescriptionAfter counting so many stars in the sky in his childhood, Isaac, now an astronomer and a mathematician uses a big astronomical telescope and lets his image proc...

2019-09-11 18:28:00 133

转载 POJ 2451 Uyuw's Concert (半平面交)

题目链接:POJ 2451Problem DescriptionPrince Remmarguts solved the CHESS puzzle successfully. As an award, Uyuw planned to hold a concert in a huge piazza named after its great designer Ihsnayish.T...

2019-09-11 18:27:00 149

转载 洛谷 P4196 [CQOI2006]凸多边形 (半平面交)

题目链接:P4196 [CQOI2006]凸多边形题意给定 \(n\) 个凸多边形,求它们相交的面积。思路半平面交半平面交的模板题。代码#include <bits/stdc++.h>using namespace std;typedef long long ll;typedef double db;const db eps = 1e-10; c...

2019-09-10 19:25:00 177

转载 P2216 [HAOI2007]理想的正方形 (单调队列)

题目链接:P2216 [HAOI2007]理想的正方形题目描述有一个 \(a\times b\)的整数组成的矩阵,现请你从中找出一个 \(n\times n\)的正方形区域,使得该区域所有数中的最大值和最小值的差最小。输入格式第一行为3个整数,分别表示a,b,n的值第二行至第a+1行每行为b个非负整数,表示矩阵中相应位置上的数。每行相邻两数之间用一空格分隔。输出格式...

2019-09-09 21:02:00 264

转载 CH1201 最大子序和 (单调队列)

题目链接:AcWing牛客题目描述输入一个长度为n的整数序列,从中找出一段不超过m的连续子序列,使得整个序列的和最大。例如 1,-3,5,1,-2,3当m=4时,S=5+1-2+3=7当m=2或m=3时,S=5+1=6输入描述:第一行两个数n,m(\(n,m \leq 300000\))第二行有n个数,要求在n个数找到最大子序和输出描述:一个数,数出他们...

2019-09-08 21:16:00 269

转载 POJ 2823 Sliding Window (单调队列)

题目链接:POJ 2823Problem DescriptionAn array of size n ≤ 10 6 is given to you. There is a sliding window of size k which is moving from the very left of the array to the very right. You can only s...

2019-09-07 23:30:00 106

转载 计算几何模板整理

#include <bits/stdc++.h>using namespace std;typedef long long ll;typedef double db;const db eps = 1e-10; // 误差const db pi = acos(-1.0); // 圆周率const ll inf = 0x3f3f3f3f3f3f3f3f; // ...

2019-09-06 22:34:00 88

转载 POJ 1265 Area (Pick定理 & 多边形面积)

题目链接:POJ 1265Problem DescriptionBeing well known for its highly innovative products, Merck would definitely be a good target for industrial espionage. To protect its brand-new research and dev...

2019-09-05 19:50:00 184

转载 POJ 3264 Balanced Lineup (ST算法)

题目链接:POJ 3264Problem DescriptionFor the daily milking, Farmer John's \(N\) cows \((1 \le N \le 50,000)\) always line up in the same order. One day Farmer John decides to organize a game of Ult...

2019-09-04 19:06:00 123

转载 HDU 5443 The Water Problem (ST算法)

题目链接:HDU 5443Problem DescriptionIn Land waterless, water is a very limited resource. People always fight for the biggest source of water. Given a sequence of water sources with \(a_1,a_2,a_3,....

2019-09-04 19:05:00 144

转载 Codeforces 743C - Vladik and fractions (构造)

Codeforces Round #384 (Div. 2)题目链接:Vladik and fractionsVladik and Chloe decided to determine who of them is better at math. Vladik claimed that for any positive integer \(n\) he can represent ...

2019-09-03 21:50:00 223

转载 BZOJ 2460 & 洛谷 P4570 [BJWC2011]元素 (线性基 贪心)

题目链接:洛谷BZOJ题意给定 \(n\) 个矿石,每个矿石有编号和魔力值两种属性,选择一些矿石,使得魔力值最大且编号的异或和不为 0。思路线性基 贪心根据矿石的魔力值从大到小排序。线性基的所有异或和都不为零。因此维护一个线性基,每次插入编号 \(i\),如果 \(i\) 与之前的线性基都线性无关,也就是能插入,就插入并将魔力值累加到 \(ans\)。#include ...

2019-09-02 22:26:00 153

转载 Codeforces 340B - Maximal Area Quadrilateral (计算几何)

Codeforces Round #198 (Div. 2)题目链接:Maximal Area QuadrilateralIahub has drawn a set of \(n\) points in the cartesian plane which he calls "special points". A quadrilateral is a simple polygon w...

2019-09-01 19:30:00 154

转载 Codeforces Round #572 (Div. 2)

比赛链接:Codeforces Round #572 (Div. 2)官方题解:Editorial of Codeforces Round #572A. Keanu Reeves题意如果一个 \(01\) 序列中 \(0\) 的数量和 \(1\) 的数量不同,就认为这个序列是“好”的。给定一个长度为 \(n\) 的 \(01\) 序列,将这个序列分割成多个“好”的序列,求最少分...

2019-08-31 21:21:00 125

转载 HDU 5251 矩形面积 (旋转卡壳)

2015年百度之星程序设计大赛 - 初赛(1) 1006比赛链接:2015年百度之星程序设计大赛 - 初赛(1)题目链接:HDU 5251Problem Description小度熊有一个桌面,小度熊剪了很多矩形放在桌面上,小度熊想知道能把这些矩形包围起来的面积最小的矩形的面积是多少。Input第一行一个正整数 \(T\),代表测试数据组数 \((1\le T\le 2...

2019-08-30 16:29:00 148

转载 洛谷 P3187 BZOJ 1185 [HNOI2007]最小矩形覆盖 (旋转卡壳)

题目链接:洛谷 P3187 [HNOI2007]最小矩形覆盖BZOJ 1185: [HNOI2007]最小矩形覆盖Description给定一些点的坐标,要求求能够覆盖所有点的最小面积的矩形,输出所求矩形的面积和四个顶点坐标Input第一行为一个整数n(3<=n<=50000)从第2至第n+1行每行有两个浮点数,表示一个顶点的x和y坐标,不用科学计数法...

2019-08-30 16:19:00 212

转载 2019 杭电多校 第十场

2019 Multi-University Training Contest 10补题链接:2019 Multi-University Training Contest 101003 Valentine's Day (HDU 6693)题意有 \(n\) 种礼物,第 \(i\) 种礼物能让女朋友开心的概率为 \(P_i\),挑一些礼物,问让女朋友开心一次的概率最大为多少。题...

2019-08-29 10:46:00 211

转载 2019 杭电多校 第八场

2019 Multi-University Training Contest 8补题链接:2019 Multi-University Training Contest 81003 Acesrc and Good Numbers HDU 6659题意定义 \(f(d, n)\) 为十进制下 \(1\) 到 \(n\) 所有数的数位中数字 \(d\) 出现的次数。给定 \(x\),...

2019-08-29 10:45:00 193

转载 2019 杭电多校 第九场

2019 Multi-University Training Contest 9补题链接:2019 Multi-University Training Contest 91005 Rikka with Game (HDU 6684)题意Rikka 和 Yuta 玩游戏。给定一个字符串。两人轮流对字符串操作。可以选择结束游戏,也可以改变其中一个字符,改变规则是:\(a\right...

2019-08-29 10:45:00 194

转载 2019 杭电多校 第七场

2019 Multi-University Training Contest 7补题链接:2019 Multi-University Training Contest 71001 A + B = C题意:给出 \(a, b, c\),求 \(x, y, z\) 满足 \(a\cdot 10^x + b\cdot 10^y = c\cdot 10^z\)。\(a, b, c \l...

2019-08-29 10:44:00 210

转载 2019 杭电多校 第六场

2019 Multi-University Training Contest 6补题链接:2019 Multi-University Training Contest 61002 Nonsense Time (HDU 6635)题意给定包含 \(n\) 个不同数字的排列 \(p\)。一开始所有数字都冻住。再给出一个长度为 \(n\) 的数组 \(k\),\(k[i]\) 表示 ...

2019-08-29 10:43:00 245

转载 2019 杭电多校 第五场

2019 Multi-University Training Contest 5补题链接:2019 Multi-University Training Contest 5罚时爆炸 自闭场1004 equation (HDU 6627)题意:给定一个整数 \(C\) 和 \(N\) 组 \(a_i,b_i\),求 \(∑_{i=1}^N|a_i\cdot x + b_i| = ...

2019-08-29 10:42:00 187

转载 2019 杭电多校 第四场

2019 Multi-University Training Contest 4补题链接:2019 Multi-University Training Contest 41001 AND Minimum Spanning Tree (HDU 6614)题意给定一个有 \(N\) 个结点的完全图,编号从 \(1\) 到 \(N\)。结点 \(x\) 与结点 \(y\) \((1\...

2019-08-29 10:41:00 258

转载 2019 杭电多校 第三场

2019 Multi-University Training Contest 3补题链接:2019 Multi-University Training Contest 31002 Blow up the city (HDU-6604)题意给定 \(n\) 个点和 \(m\) 条边的有向无环图,给出 \(q\) 次询问,每个询问给出 \(a\) 和 \(b\),求有多少个点,满足...

2019-08-29 10:39:00 185

转载 2019 杭电多校 第二场

2019 Multi-University Training Contest 2补题链接:2019 Multi-University Training Contest 21005 Everything Is Generated In Equal Probability (HDU-6595)题意给出一个整数 \(N\),在 \([1,N]\) 中随机生成一个 \(n\)。然后生成...

2019-08-29 10:38:00 169

空空如也

空空如也

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

TA关注的人

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