自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

包子不卖包子

你们为何如此的优秀!!!

  • 博客(91)
  • 收藏
  • 关注

原创 Forsaken喜欢独一无二的树【最小生成树】

题目链接题目描述 众所周知,最小生成树是指使图中所有节点连通且边权和最小时的边权子集。 不过最小生成树太简单了,我们现在来思考一个稍微复杂一点的问题。 现在给定一个n个点,m条边的图,每条边eie_iei​都有一个权值wiw_iwi​ 。定义删除一条边eie_iei​ 的代价为wiw_iwi​ ,并且你可以对这个图执行任意次删边操作。 设这个图的最小生成树权值和为sumsum,定义一个图的最小生成树是独一无二的当且仅当这个图的边集中没有除最小生成树外的其他子集能满足权值和为sum且使得所有点连通。

2022-05-23 10:11:39 200

原创 [USACO 2007 Jan S]Balanced Lineup 【线段树模板题】

题目链接题目描述 For the daily milking, Farmer John’s N cows (1 ≤ N ≤ 100,000) always line up in the same order. One day Farmer John decides to organize a game of Ultimate Frisbee with some of the cows. To keep things simple, he will take a contiguous range of c

2022-05-21 14:00:30 228

原创 tokitsukaze and Soldier【优先队列】

题目链接题目描述 在一个游戏中,tokitsukaze需要在n个士兵中选出一些士兵组成一个团去打副本。 第i个士兵的战力为v[i],团的战力是团内所有士兵的战力之和。 但是这些士兵有特殊的要求:如果选了第i个士兵,这个士兵希望团的人数不超过s[i]。(如果不选第i个士兵,就没有这个限制。) tokitsukaze想知道,团的战力最大为多少。输入描述:第一行包含一个正整数n(1≤n≤10^5)。接下来n行,每行包括2个正整数v,s(1≤v≤10^9,1≤s≤n)。输出描述:输出一个正整数,

2022-05-14 09:52:09 216

原创 第k小【优先队列】

题目链接题目描述 有一个长度为n的数组,值为 a[i], 牛牛想找到数组中第 k 小的数。比如 1 2 2 3 4 6 中,第 3 小的数就是2. 牛牛觉得这个游戏太简单了,想加一点难度,现在牛牛有 m 个操作,每个操作有两种类型。 1 x 1 代表操作一,给数组中加一个元素 x 。(0 ≤ x ≤ 1e9) 2 2 代表操作二,查询第 k 小的数。如果没有 k 个数就输出−1输入描述:第一行有三个整数,n m k,(1≤n,m,k≤2e5)第二行包含 n 个整数 a[i] (

2022-05-13 19:41:49 506

原创 数独挑战【DFS】

题目描述题目链接 数独是一种填数字游戏,英文名叫 Sudoku,起源于瑞士,上世纪 70 年代由美国一家数学逻辑游戏杂志首先发表,名为 Number Place,后在日本流行,1984 年将 Sudoku 命名为数独,即 “独立的数字” 的缩写,意思是 “在每一格只有一个数字”。 2004 年,曾任中国香港高等法院法官的高乐德 (Wayne Gould) 把这款游戏带到英国,成为英国流行的数学智力拼图游戏。 玩家需要根据9×9 盘面上的已知数字,推理出所有剩余位置的数字,并满足每一行、每一列、每一

2022-05-12 16:27:06 992

原创 [USACO 2007 Ope S]Catch That Cow [DFS]

题目描述 Farmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a point N (0 <= N <= 100,000) on a number line and the cow is at a point K (0 <= K <= 100,000) on the same number line. Farme

2022-05-02 12:01:24 352

原创 旅行【图论】

题目描述 小z放假了,准备到RRR城市旅行,其中这个城市有N个旅游景点。小z时间有限,只能在三个旅行景点进行游玩。小明租了辆车,司机很善良,说咱不计路程,只要你一次性缴费足够,我就带你走遍RRR城。小z很开心,直接就把钱一次性缴足了。然而小z心机很重,他想选择的路程尽量长。 然而司机也很聪明,他每次从一个点走到另外一个点的时候都走最短路径。你能帮帮小z吗? 需要保证这三个旅行景点一个作为起点,一个作为中转点一个作为终点。(一共三个景点,并且需要保证这三个景点不能重复)。输入描述 本题包含多组输入,

2022-05-01 20:47:00 221

原创 [HNOI2015]菜肴制作 [图论基础]

题目连接题目描述 知名美食家小A被邀请至ATM 大酒店,为其品评菜肴。 ATM 酒店为小 A 准备了 N 道菜肴,酒店按照为菜肴预估的质量从高到低给予1到N的顺序编号,预估质量最高的菜肴编号为1。 由于菜肴之间口味搭配的问题,某些菜肴必须在另一些菜肴之前制作,具体的,一共有 M 条形如”i 号菜肴’必须’先于 j 号菜肴制作“的限制,我们将这样的限制简写为<i,j>。 现在,酒店希望能求出一个最优的菜肴的制作顺序,使得小 A能尽量先吃到质量高的菜肴:也就是说, (1)在满足所有限制的

2022-04-30 10:57:03 331

原创 最短路【洛谷P4366】

最短路

2022-04-29 19:17:04 457

原创 K折交叉验算为什么能防止过拟合?

       一般情况将K折交叉验证用于模型调优,找到使得模型泛化性能最优的超参值。       一开始我们先对数据划分为测试集和训练集,然后对训练集进行交叉验证。1.过拟合​        当训练集误差较小,而测试集误差较大时,我们即可认为模型过拟合。换句话说,如果模型评估指标的方差(variance)较大,即可认为模型

2021-05-03 14:57:18 3296

原创 C语言创建指针二叉树

#include<stdio.h>#include<stdlib.h>#include<algorithm>using namespace std;const int N = 1e4;typedef struct node{ int data; struct node* left; struct node* right;}Node;Node *tree;void preorder(Node *node){ if(nod.

2021-04-14 11:32:18 171

原创 markdown入门教程(typora)

1.代码块//在英文模式下 ```+编码语言例如 ```c++```c++```2.标题# 一级标题## 二级标题### 三级标题#### 四级标题##### 五级标题###### 六级标题效果如下:一级标题二级标题三级标题四级标题五级标题六级标题3.字体//加粗**111111**//斜体又加粗***222222***//删除线~~3333~~//斜体*44444*//加粗111111//斜体又加粗222222//删除线3

2021-03-19 16:47:11 102

原创 BZOJ 4260 Codechef REBXOR

1.题链接 求两个不相交的区间各自异或后相加的最大值。n的范围1&lt;=n&lt;=4e5 首先我们知道前 i 个数的异或和前 j 个数的异或相异或: pre[i]^pre[j] = a[i+1]^a[i+2]^……^a[j],(i&lt;j)。异或的后缀和类似。 于是我们可以先求出异或的前缀 suf[i]和后缀和 fi[i]。dp[i]表示前 i个数中任意区间异或的...

2018-10-16 16:57:33 283

原创 Codeforces 1064D Labyrinth(双向队列,BFS)

You are playing some computer game. One of its levels puts you in a maze consisting of n lines, each of which contains m cells. Each cell either is free or is occupied by an obstacle. The starting cel...

2018-10-15 17:23:09 577

原创 BZOJ3631 [JLOI2014]松鼠的新家

Description松鼠的新家是一棵树,前几天刚刚装修了新家,新家有n个房间,并且有n-1根树枝连接,每个房间都可以相互到达,且俩个房间之间的路线都是唯一的。天哪,他居然真的住在“树”上。松鼠想邀请小熊维尼前来参观,并且还指定一份参观指南,他希望维尼能够按照他的指南顺序,先去a1,再去a2,……,最后到an,去参观新家。可是这样会导致维尼重复走很多房间,懒惰的维尼不听地推辞。可是松鼠告诉...

2018-10-04 09:30:01 239

原创 Codeforces 1051D Bicolorings

You are given a grid, consisting of 2 rows and n columns. Each cell of this grid should be colored either black or white.Two cells are considered neighbours if they have a common border and share th...

2018-09-21 13:53:41 899

原创 Codeforces 1042 C Array Product

You are given an array a consisting of nintegers. You can perform the following operations with it:Choose some positions i and j (1≤i,j≤n,i≠j), write the value of ai⋅aj into the j-th cell and remo...

2018-09-18 09:55:08 341

原创 Codeforces 245H Queries for Number of Palindromes (区间DP)

You've got a string s = s1s2... s|s| of length |s|, consisting of lowercase English letters. There also are q queries, each query is described by two integers li, ri (1 ≤ li ≤ ri ≤ |s|). The answer to...

2018-09-12 15:28:34 223

原创 HDU 3631 Shortest Path

When YY was a boy and LMY was a girl, they trained for NOI (National Olympiad in Informatics) in GD team. One day, GD team’s coach, Prof. GUO asked them to solve the following shortest-path problem.T...

2018-09-06 23:46:25 263 1

原创 Codeforces 1037D Valid BFS? (BFS)

The BFS algorithm is defined as follows.Consider an undirected graph with vertices numbered from 1 to n. Initialize q as a new queue containing only vertex 1, mark the vertex 1 as used. Extract a v...

2018-09-03 22:52:38 857

原创 HDU 5187 zhx's contest (高精度快速幂)

Problem DescriptionAs one of the most powerful brushes, zhx is required to give his juniors n problems.zhx thinks the ith problem's difficulty is i. He wants to arrange these problems in a beautifu...

2018-08-28 09:11:58 261

原创 HDU 3265 Posters

Problem DescriptionTed has a new house with a huge window. In this big summer, Ted decides to decorate the window with some posters to prevent the glare outside. All things that Ted can find are rec...

2018-08-27 23:29:54 186

原创 Codeforces 1029C Maximal Intersection

You are given n segments on a number line; each endpoint of every segment has integer coordinates. Some segments can degenerate to points. Segments can intersect with each other, be nested in each oth...

2018-08-25 22:59:32 517

原创 牛客练习赛25 C 再编号

题目描述n 个人,每个人有一个编号 ai 。定义对 a 的再编号为 a' ,满足 。现在有 m 次询问,每次给定 x,t ,表示询问经过 t 次再编号后第 x 个人的编号。由于答案可能很大,所以对 109+7 取模。输入描述:第一行 2 个数 n,m ,表示人数和询问次数;接下来一行 n 个数,表示 ai ;接下来 m 行,每行 2 个数 x,t ,描述一次询问。...

2018-08-25 09:18:13 370

原创 HDU 5692 Snacks

Problem Description百度科技园内有n个零食机,零食机之间通过n−1条路相互连通。每个零食机都有一个值v,表示为小度熊提供零食的价值。由于零食被频繁的消耗和补充,零食机的价值v会时常发生变化。小度熊只能从编号为0的零食机出发,并且每个零食机至多经过一次。另外,小度熊会对某个零食机的零食有所偏爱,要求路线上必须有那个零食机。为小度熊规划一个路线,使得路线上的价值总和最大。...

2018-08-24 09:33:29 210

原创 分块入门1~9 (完结撒花)

LOJ终于肝完了分块的九种基础类型,调bug调得是真(超)是(级)开(恶)心。有脑残的时候,把块的编号当成元素的下表。数组开太小会莫名超时。建议读者刷LOJ上的分块入门1~9loj#6277. 数列分块入门 1区间加法,单点查询基础的东西数学老师曰:基本知识不熟悉,难题不会做!分块 每个块的大小都是sqrt(n)n=12 N=sqrt(12) 向下取整 3第一块:1...

2018-08-23 23:26:19 501

原创 Wannafly挑战赛22 D 整数序列

题目描述给出一个长度为n的整数序列a1,a2,...,an,进行m次操作,操作分为两类。操作1:给出l,r,v,将al,al+1,...,ar分别加上v;操作2:给出l,r,询问输入描述:第一行一个整数n接下来一行n个整数表示a1,a2,...,an接下来一行一个整数m接下来m行,每行表示一个操作,操作1表示为1 l r v,操作2表示为2 l r保证1≤n,m,ai,v...

2018-08-22 11:21:18 377

原创 区间DP BZOJ 3229石子合并

Description  在一个操场上摆放着一排N堆石子。现要将石子有次序地合并成一堆。规定每次只能选相邻的2堆石子合并成新的一堆,并将新的一堆石子数记为该次合并的得分。  试设计一个算法,计算出将N堆石子合并成一堆的最小得分.Input  第一行是一个数N。以下N行每行一个数A,表示石子数目。Output  共一个数,即N堆石子合并成一堆的最小得分。Sample In...

2018-08-21 19:29:42 374

原创 Codeforces 1027D Mouse Hunt

Medicine faculty of Berland State University has just finished their admission campaign. As usual, about 80% of applicants are girls and majority of them are going to live in the university dormitory ...

2018-08-20 13:53:51 471

原创 Codeforces 1025B Weakened Common Divisor

During the research on properties of the greatest common divisor (GCD) of a set of numbers, Ildar, a famous mathematician, introduced a brand new concept of the weakened common divisor (WCD) of a list...

2018-08-20 09:59:07 468

原创 牛客小白月赛6 J 洋灰三角

题目描述    洋灰是一种建筑材料,常用来筑桥搭建高层建筑,又称,水泥、混凝土。    WHZ有很多铸造成三角形的洋灰块,他想把这些洋灰三角按照一定的规律放到摆成一排的n个格子里,其中第i个格子放入的洋灰三角数量是前一个格子的k倍再多p个,特殊地,第一个格子里放1个。    WHZ想知道把这n个格子铺满需要多少洋灰三角。输入描述:第一行有3个正整数n,k,p。输出描述:...

2018-08-19 11:05:57 340

原创 Codeforces 1009D Relatively Prime Graph

Let's call an undirected graph G=(V,E) relatively prime if and only if for each edge (v,u)∈E  GCD(v,u)=1 (the greatest common divisor of v and u is 1). If there is no edge between some pair of vertice...

2018-08-18 00:49:41 196

原创 Codeforces 1005F Berland and the Shortest Paths

There are n cities in Berland. Some pairs of cities are connected by roads. All roads are bidirectional. Each road connects two different cities. There is at most one road between a pair of cities. Th...

2018-08-17 00:16:07 433

原创 Codeforces 1006E Military Problem

In this problem you will have to help Berland army with organizing their command delivery system.There are n officers in Berland army. The first officer is the commander of the army, and he does not...

2018-08-15 23:53:07 276

原创 ZOJ 3593 One Person Game (乘法逆元)

There is an interesting and simple one person game. Suppose there is a number axis under your feet. You are at point A at first and your aim is point B. There are 6 kinds of operations you can perform...

2018-08-14 18:54:28 208

原创 ZOJ 4712 Modular Inverse (乘法逆元)

The modular modular multiplicative inverse of an integer a modulo m is an integer x such that a-1≡x (mod m). This is equivalent to ax≡1 (mod m).InputThere are multiple test cases. The first line o...

2018-08-14 15:17:59 281

原创 Hoj 1042 I-KeyBoard

Problem DescriptionMost of you have probably tried to type an SMS message on the keypad of a cellular phone. It is sometimes very annoying to write longer messages, because one key must be usually p...

2018-08-13 13:26:40 331

原创 Poj 1704 Georgia and Bob

DescriptionGeorgia and Bob decide to play a self-invented game. They draw a row of grids on paper, number the grids from left to right by 1, 2, 3, ..., and place N chessmen on different grids, as sh...

2018-08-12 22:37:10 287

原创 Codeforces 1016C Vasya And The Mushrooms

Vasya's house is situated in a forest, and there is a mushroom glade near it. The glade consists of two rows, each of which can be divided into n consecutive cells. For each cell Vasya knows how fast ...

2018-08-12 11:29:57 355

原创 Codefrces 1017C. The Phone Number

Mrs. Smith is trying to contact her husband, John Smith, but she forgot the secret phone number!The only thing Mrs. Smith remembered was that any permutation of ncan be a secret phone number. Only...

2018-08-12 10:23:27 190

空空如也

空空如也

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

TA关注的人

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