自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 牛牛去买球 思维+背包

链接:https://acm.nowcoder.com/acm/problem/21668来源:牛客网时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 524288K,其他语言1048576K64bit IO Format: %lld题目描述一个人如果在他很小的时候就自己赚过钱,他的一生都会过得非常节俭,因为他知道财富来之不易.作为一个勤俭节约的好孩子,牛牛决定...

2019-09-25 17:01:44 356

原创 被3整除的子序列 ———牛客竞赛 DP

链接:https://acm.nowcoder.com/acm/problem/21302来源:牛客网时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 524288K,其他语言1048576K64bit IO Format: %lld题目描述给你一个长度为50的数字串,问你有多少个子序列构成的数字可以被3整除答案对1e9+7取模输入描述:输入一个字符串,由...

2019-09-24 19:11:24 242

原创 删除子串 --牛客竞赛 DP

链接:https://acm.nowcoder.com/acm/problem/15362来源:牛客网题目描述给你一个长度为n且由a和b组成的字符串,你可以删除其中任意的部分(可以不删),使得删除后的子串“变化”次数小于等于m次且最长。变化:如果a[i]!=a[i+1]则为一次变化。(且新的字符串的首字母必须是'a')如果初始串全为b,则输出0。输入描述:第一行...

2019-09-24 17:41:49 327

原创 Shooting HDU - 4866 主席树+思维

In the shooting game, the player can choose to stand in the position of [1, X] to shoot, you can shoot all the nearest K targets. The value of K may be different on different shootings. There are N ta...

2019-09-05 16:27:03 188

原创 Spreading the Wealth UVA - 11300 思维+中位数

ProblemA Communist regime is trying to redistribute wealth in a village. They have have decided to sit everyone around a circular table. First, everyone has converted all of their properties to coins...

2019-09-05 15:46:49 174

原创 K-Dimensional Foil II HihoCoder - 1835 思维+二分

"K-Dimensional Foil" is a dimensional weapon. Its function is quite easy: It can ascend a region in 3D space to K (K≥3) dimension. One can use it to give the enemy unexpected attack. It was called "Th...

2019-09-05 15:35:54 194

原创 Game 2019 年百度之星·程序设计大赛 - 初赛一 思维

GameTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 547Accepted Submission(s): 107Problem Description度度熊在玩一个好玩的游戏。游戏的主人公站在一根数轴上,他可...

2019-08-18 11:27:27 201

原创 原 2019牛客暑期多校训练营(第九场) D Knapsack Cryptosystem 超大背包(二分搜索)

链接:https://ac.nowcoder.com/acm/contest/889/D?&headNav=acm来源:牛客网时间限制:C/C++ 2秒,其他语言4秒空间限制:C/C++ 262144K,其他语言524288K64bit IO Format: %lld题目描述Amy asks Mr. B problem D. Please help Mr. B to...

2019-08-16 21:21:27 212

原创 2019牛客暑期多校训练营(第九场) E All men are brothers 并查集+数学

链接:https://ac.nowcoder.com/acm/contest/889/E?&headNav=acm&headNav=acm来源:牛客网题目描述Amy asks Mr. B problem E. Please help Mr. B to solve the following problem.There are n people, who d...

2019-08-16 14:37:38 125

原创 2019牛客暑期多校训练营(第九场) H Cutting Bamboos 主席树+二分

链接:https://ac.nowcoder.com/acm/contest/889/H来源:牛客网时间限制:C/C++ 5秒,其他语言10秒空间限制:C/C++ 262144K,其他语言524288KSpecial Judge, 64bit IO Format: %lld题目描述There are n bamboos arranged in a line. The i-th...

2019-08-16 12:29:54 492

原创 Petya and Array CodeForces - 1042D 线段树+思维

Petya has an arrayaaconsisting ofnnintegers. He has learned partial sums recently, and now he can calculate the sum of elements on any segment of the array really fast. The segment is a non-empty ...

2019-08-15 11:04:11 282

原创 Magnificent Tree 牛客竞赛 三维偏序问题 CDQ分治+树状数组

链接:https://ac.nowcoder.com/acm/contest/106/H?&headNav=www来源:牛客网It’s universally acknowledged that there’re innumerable trees in the campus of HUST.There is a new leisure ground at the ga...

2019-08-13 21:08:07 251

原创 陌上花开 HYSBZ - 3262 三维偏序问题 CDQ分治+树状数组

有n朵花,每朵花有三个属性:花形(s)、颜色(c)、气味(m),用三个整数表示。现在要对每朵花评级,一朵花的级别是它拥有的美丽能超过的花的数量。定义一朵花A比另一朵花B要美丽,当且仅Sa>=Sb,Ca>=Cb,Ma>=Mb。显然,两朵花可能有同样的属性。需要统计出评出每个等级的花的数量。Input第一行为N,K (1 <= N <= 100,000...

2019-08-13 21:04:42 154

原创 Stars POJ - 2352 二维偏序问题CDQ分治

Astronomers often examine star maps where stars are represented by points on a plane and each star has Cartesian coordinates. Let the level of a star be an amount of the stars that are not higher and ...

2019-08-13 21:02:49 259 1

原创 敌兵布阵 HDU - 1166 二维偏序CDQ分治

C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视。中央情报局要研究敌人究竟演习什么战术,所...

2019-08-13 20:59:22 159

原创 小Z的加油店 HYSBZ - 5028 线段树+数学

小Z经营一家加油店。小Z加油的方式非常奇怪。他有一排瓶子,每个瓶子有一个容量vi。每次别人来加油,他会让别人选连续一段的瓶子。他可以用这些瓶子装汽油,但他只有三种操作:1.把一个瓶子完全加满;2.把一个瓶子完全倒空;3.把一个瓶子里的汽油倒进另一个瓶子,直到倒出瓶子空了或者倒进的瓶子满了。当然,为了回馈用户,小Z会时不时选择连续一段瓶子,给每个瓶子容积都增加x。为了尽可能给...

2019-08-12 16:00:53 187

原创 牛客竞赛 整数序列 线段树+数学

链接:https://ac.nowcoder.com/acm/contest/160/D?&headNav=www来源:牛客网题目描述给出一个长度为n的整数序列a1,a2,...,an,进行m次操作,操作分为两类。操作1:给出l,r,v,将al,al+1,...,ar分别加上v;操作2:给出l,r,询问∑i=lrsin(ai)\sum\limits_{i=l}^{r}si...

2019-08-12 15:46:39 236

原创 No Pain No Game HDU - 4630 线段树+离线处理

Life is a game,and you lose it,so you suicide.But you can not kill yourself before you solve this problem:Given you a sequence of number a1, a2, ..., an.They are also a permutation of 1...n.Y...

2019-08-12 15:39:41 143

原创 Different GCD Subarray Query HDU - 5869 线段树+离线处理

This is a simple problem. The teacher gives Bob a list of problems about GCD (Greatest Common Divisor). After studying some of them, Bob thinks that GCD is so interesting. One day, he comes up with a ...

2019-08-12 15:28:34 152

原创 GCD HDU - 5930

Mr. Frog likes generating numbers! He can generate many numbers from a sequence.For a given sequencea1,a2,⋯,ana1,a2,⋯,anMr. Frog can choose two numbers l and r (1≤l≤r≤n1≤l≤r≤n) and calculate the g...

2019-08-12 15:14:36 205

原创 K-th Closest Distance HDU - 6621 主席树+二分

K-th Closest DistanceTime Limit: 20000/15000 MS (Java/Others)Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 3305Accepted Submission(s): 1186Problem DescriptionYou hav...

2019-08-11 18:18:29 126

原创 Snowy Smile HDU - 6638 利用线段树区间合并 求最大子段和

Snowy SmileTime Limit: 4000/4000 MS (Java/Others)Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 2429Accepted Submission(s): 774Problem DescriptionThere arenpirate c...

2019-08-11 16:03:28 249

原创 Longest Subarray HDU - 6602 线段树+思维

You are given two integersC,KC,Kand an array ofNNintegersa1,a2,...,aNa1,a2,...,aN. It is guaranteed that the value ofaiaiis between11toCC.We define that a continuous subsequenceal,al+1,.....

2019-08-11 11:39:30 129

原创 GCD HDU - 5726 线段树+数学

Give you a sequence ofN(N≤100,000)N(N≤100,000)integers :a1,...,an(0<ai≤1000,000,000)a1,...,an(0<ai≤1000,000,000). There areQ(Q≤100,000)Q(Q≤100,000)queries. For each queryl,rl,ryou have to...

2019-08-10 11:25:18 215

原创 Sasha and Array CodeForces - 719E 线段树维护矩阵+矩阵快速幂

Sasha has an array of integersa1, a2, ..., an. You have to performmqueries. There might be queries of two types:1 l r x— increase all integers on the segment fromltorby valuesx; 2 l r— fi...

2019-08-09 15:29:24 220

原创 CodeForces 538F A Heap of Heaps 主席树

Andrew skipped lessons on the subject 'Algorithms and Data Structures' for the entire term. When he came to the final test, the teacher decided to give him a difficult task as a punishment.The teach...

2019-08-09 15:05:07 152

原创 Super Mario HDU - 4417 主席树/线段树离线处理

Mario is world-famous plumber. His “burly” figure and amazing jumping ability reminded in our memory. Now the poor princess is in trouble again and Mario needs to save his lover. We regard the road to...

2019-08-09 14:32:58 113

原创 HDU 3333 Turing Tree 主席树/线段树离线处理

After inventing Turing Tree, 3xian always felt boring when solving problems about intervals, because Turing Tree could easily have the solution. As well, wily 3xian made lots of new problems about int...

2019-08-09 14:18:47 251

原创 D-query SPOJ - DQUERY 主席树/线段树离线处理

Given a sequence of n numbers a1, a2, ..., anand a number of d-queries. A d-query is a pair (i, j) (1 ≤ i ≤ j ≤ n). For each d-query (i, j), you have to return the number of distinct elements in the ...

2019-08-09 14:05:11 179

原创 LCIS HDU - 3308 线段树区间合并

Given n integers.You have two operations:U A B: replace the Ath number by B. (index counting from 0)Q A B: output the length of the longest consecutive increasing subsequence (LCIS) in [a, b]....

2019-08-09 13:47:16 176

原创 Hotel POJ - 3667 线段树区间合并

The cows are journeying north to Thunder Bay in Canada to gain cultural enrichment and enjoy a vacation on the sunny shores of Lake Superior. Bessie, ever the competent travel agent, has named the Bul...

2019-08-09 13:41:57 119

原创 Tunnel Warfare HDU - 1540 线段树区间合并

During the War of Resistance Against Japan, tunnel warfare was carried out extensively in the vast areas of north China Plain. Generally speaking, villages connected by tunnels lay in a line. Except t...

2019-08-09 13:20:41 111

原创 Keen On Everything But Triangle HDU6601 主席树

Keen On Everything But TriangleTime Limit: 6000/3000 MS (Java/Others)Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 4646Accepted Submission(s): 523Problem Description...

2019-08-09 12:57:55 127

原创 2019牛客暑期多校训练营(第七场) 权值线段树或主席树

链接:https://ac.nowcoder.com/acm/contest/887/C题目描述The Wow village is often hit by wind and sand,the sandstorm seriously hindered the economic development of the Wow village.There is a forest in fr...

2019-08-09 11:02:37 132

原创 Sign on Fence CodeForces - 484E 可持久化线段树区间合并+二分

Bizon the Champion has recently finished painting his wood fence. The fence consists of a sequence ofnpanels of1meter width and of arbitrary height. Thei-th panel's height ishimeters. The adjac...

2019-08-03 20:08:00 299

原创 Physical Education Lessons CodeForces - 915E 线段树+离散化

This year Alex has finished school, and now he is a first-year student of Berland State University. For him it was a total surprise that even though he studies programming, he still has to attend phys...

2019-07-09 09:44:00 178

原创 Mayor's posters POJ - 2528 线段树+离散化

The citizens of Bytetown, AB, could not stand that the candidates in the mayoral election campaign have been placing their electoral posters at all places at their whim. The city council has finally d...

2019-07-08 17:19:23 117

原创 Infinite Inversions CodeForces - 540E 线段树+离散化

There is an infinite sequence consisting of all positive integers in the increasing order:p = {1, 2, 3, ...}. We performednswapoperations with this sequence. Aswap(a, b)is an operation of swappi...

2019-07-08 16:12:51 157

原创 牛客 A-Laptop 线段树

题目描述FST是一名可怜的小朋友,他很强,但是经常fst,所以rating一直低迷。但是重点在于,他非常适合ACM!并在最近的区域赛中获得了不错的成绩。拿到奖金后FST决定买一台新笔记本,但是FST发现,在价格能承受的范围内,笔记本的内存和速度是不可兼得的。可是,有一些笔记本是被另外一些“完虐”的,也就是内存和速度都不高于另外某一个笔记本,现在FST想统计一下有多少笔记本被“完虐”。...

2019-07-08 15:14:00 338

原创 A - Ultra-QuickSort POJ - 2299 线段树

DescriptionIn this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers by swapping two adjacent sequence elements until the seque...

2019-07-08 14:54:01 179

空空如也

空空如也

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

TA关注的人

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