自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

待到山花烂漫时

你指尖流动的代码是我不变的信仰

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

原创 【洛谷】 P1119 灾后重建 最短路floyd算法

题目背景BB地区在地震过后,所有村庄都造成了一定的损毁,而这场地震却没对公路造成什么影响。但是在村庄重建好之前,所有与未重建完成的村庄的公路均无法通车。换句话说,只有连接着两个重建完成的村庄的公路才能通车,只能到达重建完成的村庄。题目描述给出BB地区的村庄数NN,村庄编号从00到N-1N−1,和所有MM条公路的长度,公路是双向的。并给出第ii个村庄重建完成的时间t_iti​ ,你可以认...

2020-03-31 20:39:06 253

原创 【洛谷】P1972 [SDOI2009]HH的项链 离线预处理 + 树状数组

题目描述HH 有一串由各种漂亮的贝壳组成的项链。HH 相信不同的贝壳会带来好运,所以每次散步完后,他都会随意取出一段贝壳,思考它们所表达的含义。HH 不断地收集新的贝壳,因此,他的项链变得越来越长。有一天,他突然提出了一个问题:某一段贝壳中,包含了多少种不同的贝壳?这个问题很难回答…… 因为项链实在是太长了。于是,他只好求助睿智的你,来解决这个问题。输入格式一行一个正整数 nn,表示项链长...

2020-03-30 20:31:22 165

原创 【BZOJ】采花2743: [HEOI2012] 树状数组 + 离线预处理 超详解【校队排位赛#12 J】

Description萧芸斓是Z国的公主,平时的一大爱好是采花。今天天气晴朗,阳光明媚,公主清晨便去了皇宫中新建的花园采花。花园足够大,容纳了n朵花,花有c种颜色(用整数1-c表示),且花是排成一排的,以便于公主采花。公主每次采花后会统计采到的花的颜色数,颜色数越多她会越高兴!同时,她有一癖好,她不允许最后自己采到的花中,某一颜色的花只有一朵。为此,公主每采一朵花,要么此前已采到此颜色的花...

2020-03-29 21:28:12 170

原创 【校队排位赛#11 A】 Friend or Girlfriend basic 数学

Shlok and Sachin are good friends. Shlok wanted to test Sachin, so he wrote down a string S with length N and one character X. He wants Sachin to find the number of different substrings of S which con...

2020-03-28 20:19:34 254

原创 【校队排位赛#11 B】 Songs Compression Cdeforces 贪心

Songs Compressiontime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputIvan has n songs on his phone. The size of the i-th song is ai bytes. Ivan al...

2020-03-28 20:03:35 205

原创 【校队排位赛#11 H】 HDU Sequence LIS

Problem DescriptionThere is a sequence X (i.e. x[1], x[2], …, x[n]). We define increasing subsequence of Xas x[i1], x[i2],…,x[ik], which satisfies follow conditions:x[i1] < x[i2],…,<x[ik];1...

2020-03-28 18:11:30 205

原创 【模板】矩阵快速幂 洛谷 P3390

题目背景矩阵快速幂题目描述给定 n\times nn×n 的矩阵 AA,求 A^kAk。输入格式第一行两个整数 n,kn,k 接下来 nn 行,每行 nn 个整数,第 ii 行的第 jj 的数表示 A_{i,j}Ai,j​ 。输出格式输出 A^kAk共 nn 行,每行 nn 个数,第 ii 行第 jj 个数表示 (A^k)_{i,j}(Ak)i,j​ ,每个元...

2020-03-27 00:43:36 398

原创 【HDU Frequent values】 RMQ算法 超详解 【校队排位赛#10 A】

Problem DescriptionYou are given a sequence of n integers a1 , a2 , … , an in non-decreasing order. In addition to that, you are given several queries consisting of indices i and j (1 ≤ i ≤ j ≤ n). F...

2020-03-26 13:23:37 232

原创 【POJ Balanced Lineup】 RMQ算法

DescriptionFor the daily milking, Farmer John’s N cows (1 ≤ N ≤ 50,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 ...

2020-03-25 22:20:01 170

原创 【洛谷 P3372】【模板】线段树 1 pushdown 操作

题目描述如题,已知一个数列,你需要进行下面两种操作:将某区间每一个数加上 kk。求出某区间每一个数的和。输入格式第一行包含两个整数 n, mn,m,分别表示该数列数字的个数和操作的总个数。第二行包含 nn 个用空格分隔的整数,其中第 ii 个数字表示数列第 ii 项的初始值。接下来 mm 行每行包含 33 或 44 个整数,表示一个操作,具体如下:1 x y k:将区间 [x, y...

2020-03-25 12:35:13 226 2

原创 【18718 航行】 贪心 or DP SCAU 数据结构习题

18718 航行时间限制:1000MS 内存限制:65535K提交次数:0 通过次数:0题型: 编程题 语言: 不限定Description银河帝国正走向覆亡。为保留文明的种子,你需要驾驶飞船将一批“颛家”从帝国首都护送至银河边缘的基地。现在已知航线是一条直线,帝国首都为起点(坐标0),基地为终点(坐标L),在这条航线上有N个空间站可以补充飞船的能源。第i个空间站的坐标为ai,...

2020-03-24 15:45:49 460

原创 【HDU Ant Trip】 欧拉图 + 并查集

Ant Country consist of N towns.There are M roads connecting the towns.Ant Tony,together with his friends,wants to go through every part of the country.They intend to visit every road , and every roa...

2020-03-22 20:42:19 216

原创 【校队排位赛#10 B】 The Same Calendar 基础 周期

The Same Calendartime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe girl Taylor has a beautiful calendar for the year y. In the calendar all ...

2020-03-22 17:55:32 309

原创 【校队排位赛#10 D】 Codeforces Hard Process 二分

Hard Processtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an array a with n elements. Each element of a is either 0 or 1.Let’...

2020-03-22 17:49:47 153

原创 【校队排位赛#10 J】Duff in Love 数论

Duff is in love with lovely numbers! A positive integer x is called lovely if and only if there is no such positive integer a > 1 such that a2 is a divisor of x.Malek has a number store! In his st...

2020-03-22 17:35:28 189

原创 【校队排位赛#9 A】 Codeforces 521 DNA Alignment 思维

DNA Alignmenttime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputVasya became interested in bioinformatics. He’s going to write an article about ...

2020-03-21 19:57:01 189 1

原创 【校队排位赛#9 K】Codeforces 578 "Or" Game 贪心 位运算 前后缀

“Or” Gametime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given n numbers a1, a2, …, an. You can perform at most k operations. For eac...

2020-03-21 19:36:32 107

原创 【校队排位赛#9 B】Codeforces 543 Destroying Roads 最短路径 + 去重边 SPFA

B. Destroying Roadstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIn some country there are exactly n cities and m bidirectional roads conne...

2020-03-21 19:19:23 130

原创 【18290 校赛排名2】 哈希 水题 SCAU

Description下面是校赛的排名规则:比赛期间,提交代码后,系统会返回正确或错误等结果。最后的获胜者为正确解答题目最多,如果同题数则总用时最少的队伍。每道试题的时间花费将从竞赛开始到试题提交并且被判定为正确为止,其间每一次提交运行结果被判错误的话将被加罚20分钟时间,未正确解答的试题不记时,如果已经返回正确的题目再重复提交则不影响结果。例如:A、B两队都正确完成两道题目,其中A队提...

2020-03-18 21:11:20 466

原创 【校队排位赛#7 H】 HDU NPY and girls 莫队算法 + 费马小定理 + 快速幂

NPY and girlsTime Limit: 8000/4000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2776 Accepted Submission(s): 896Problem DescriptionNPY’s girlfriend blew him...

2020-03-16 23:45:45 206

原创 【校队排位赛#7 J】 HDU 2196 Computer 树形DP 详解

Problem DescriptionA school bought the first computer some time ago(so this computer’s id is 1). During the recent years the school bought N-1 new computers. Each new computer was connected to one of...

2020-03-15 11:55:24 150

原创 【18715 出栈序列】 模拟 贪心+双指针

Description一种简洁的栈定义方法如下int st[1000],top=0;//以top作为栈顶指针,top==0为空栈st[top++]=x;//把x入栈,栈顶指针+1top–;//出栈现在有一个1-n的排列,入栈序列已知,请给出字典序最大的出栈序列。输入格式第一行一个整数n。(1<=n<=100)第二行n个整数,数据确保为1-n的排列。输出格式输出n个整...

2020-03-13 09:41:16 1245

原创 【校队排位赛#5 F】 POJ 3259 Wormholes SPFA +负权环

DescriptionWhile exploring his many farms, Farmer John has discovered a number of amazing wormholes. A wormhole is very peculiar because it is a one-way path that delivers you to its destination at a...

2020-03-08 23:04:14 157

原创 【校队排位赛#6 I】POJ Crashing Robots

DescriptionIn a modernized warehouse, robots are used to fetch the goods. Careful planning is needed to ensure that the robots reach their destinations without crashing into each other. Of course, al...

2020-03-08 20:36:38 144

原创 【校队排位赛#6 H】 CodeForces - 736B Taxes 哥德巴赫猜想

B. Taxestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputMr. Funt now lives in a country with a very specific tax laws. The total income of mr...

2020-03-08 20:12:34 235

原创 【校队排位赛#6 G】 Bear and Friendship Condition codeforces 并查集 + 思维

Bear Limak examines a social network. Its main functionality is that two members can become friends (then they can talk with each other and share funny pictures).There are n members, numbered 1 throu...

2020-03-08 19:52:15 302

原创 【校队排位赛#6 E】 HDU 1029——建筑抢修 贪心 + 优先队列(详解)

Description  小刚在玩JSOI提供的一个称之为“建筑抢修”的电脑游戏:经过了一场激烈的战斗,T部落消灭了所有z部落的入侵者。但是T部落的基地里已经有N个建筑设施受到了严重的损伤,如果不尽快修复的话,这些建筑设施将会完全毁坏。现在的情况是:T部落基地里只有一个修理工人,虽然他能瞬间到达任何一个建筑,但是修复每个建筑都需要一定的时间。同时,修理工人修理完一个建筑才能修理下一个建筑,...

2020-03-08 19:10:24 182

原创 【校队排位赛#5 B】 codeforces 627 A. XOR Equation 详解

A. XOR Equationtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputTwo positive integers a and b have a sum of s and a bitwise XOR of x. How many...

2020-03-07 22:36:09 288

原创 【洛谷】P1217 回文质数 Prime Palindromes DFS

题目描述因为 151 既是一个质数又是一个回文数(从左到右和从右到左是看一样的),所以 151 是回文质数。写一个程序来找出范围 [a,b] (5≤a<b≤100,000,000)a,b( 一亿)间的所有回文质数。输入格式第 1 行: 二个整数 a 和 b .输出格式输出一个回文质数的列表,一行一个。输入输出样例输入 #1复制5 500输出 #1复制5711101...

2020-03-04 13:06:31 671

原创 1109 综合实验:文件操作与字符处理 【SCAU 模拟哈希 清一流的算法思路】

Description在当前目录中存在文件名为"case1.in"(其中case后为数字1,不是字母l,写错提交后会判错)的文本文件,其内容为一篇英文文章(以EOF作为结束标志)。现要求读取该文本文件内容,统计文章中每个单词出现的次数,并输出出现次数最多的前5个单词及其出现次数(按出现次数由多到少的顺序输出,次数相同时按字典顺序输出,不足5个单词时,按序输出全部单词)。程序中注意如下细节:...

2020-03-03 19:00:55 3681

原创 【浅谈高精度乘法】

本文写一下高精度乘法的代码化思路。基于高精度加法之上,前面预处理两个字符串以及转化为整型数组存储的过程我就不讲了。这里着力讲一下竖式计算的具体模拟过程引入:我们先来回顾一下竖式计算的特点,分位计算,错位相加。比如 (0用来补齐)0 5 4 3 2x 0 6 7 8先是8乘上5432得到一行,再将位置移动到7, 7 x 5432,以此类推。注意到每移动一次下面那个...

2020-03-02 20:17:11 357

空空如也

空空如也

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

TA关注的人

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