解题报告
文章平均质量分 76
轩辕青山
这个作者很懒,什么都没留下…
展开
-
codeforces 604 div2 B.Beautiful Numbers
B. Beautiful Numberstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a permutation p=[p1,p2,…,pn] of integers from 1 to n. Let’s ...原创 2020-02-18 10:53:45 · 170 阅读 · 0 评论 -
codeforce 621(div1+div2) B Cow and Friend
Bessie has way too many friends because she is everyone’s favorite cow! Her new friend Rabbit is trying to hop over so they can play!More specifically, he wants to get from (0,0) to (x,0) by making m...原创 2020-02-18 09:13:14 · 354 阅读 · 0 评论 -
coderforce 618(div2) CAnu Has a Function( 补)
C. Anu Has a Functiontime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAnu has created her own function f: f(x,y)=(x|y)−y where | denotes the bi...原创 2020-02-10 11:59:01 · 162 阅读 · 0 评论 -
青蛙的约会poj1061【扩展欧几里德】
两只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面。它们很高兴地发现它们住在同一条纬度线上,于是它们约定各自朝西跳,直到碰面为止。可是它们出发之前忘记了一件很重要的事情,既没有问清楚对方的特征,也没有约定见面的具体位置。不过青蛙们都是很乐观的,它们觉得只要一直朝着某个方向跳下去,总能碰到对方的。但是除非这两只青蛙在同一时间跳到同一点上,不然是永远都不可能碰面的。为了帮助这两只乐观的青蛙,...原创 2019-12-07 19:59:58 · 117 阅读 · 0 评论 -
HDU 4578 Transformation(线段树+有技巧的懒标记下放)
Yuanfang is puzzled with the question below:There are n integers, a 1, a 2, …, a n. The initial values of them are 0. There are four kinds of operations.Operation 1: Add c to each number between a x...原创 2019-11-19 22:40:40 · 95 阅读 · 0 评论 -
Rikka with Cake(线段树+线段树)
ikka's birthday is on June 12th. The story of this problem happens on that day.Today is Rikka's birthday. Yuta prepares a big cake for her: the shape of this cake is a rectangular ofnncentimeters t...原创 2019-11-16 11:07:21 · 247 阅读 · 0 评论 -
Power Strings【KMP循环节】
Given two strings a and b we define ab to be their concatenation. For example, if a = “abc” and b = “def” then ab = “abcdef”. If we think of concatenation as multiplication, exponentiation by a non-ne...原创 2019-10-30 14:22:38 · 110 阅读 · 0 评论 -
【51nod 1215】数组的宽度
N个整数组成的数组,定义子数组a[i]…a[j]的宽度为:max(a[i]…a[j]) - min(a[i]…a[j]),求所有子数组的宽度和。思路:维护两个单调栈,累加最大值*最大值覆盖的区间长度maxsum 和 最小值与最小值福海区间长度minsum maxsum-minsum就是答案代码:#include<iostream>#include<cstdio>...原创 2019-10-24 19:47:29 · 295 阅读 · 0 评论 -
51nod1277 字符串中的最大值【KMP】
一个字符串的前缀是指包含该字符第一个字母的连续子串,例如:abcd的所有前缀为a, ab, abc, abcd。给出一个字符串S,求其所有前缀中,字符长度与出现次数的乘积的最大值。例如:S = “abababa” 所有的前缀如下:“a”, 长度与出现次数的乘积 1 * 4 = 4,“ab”,长度与出现次数的乘积 2 * 3 = 6,“aba”, 长度与出现次数的乘积 3 * 3 = 9,...原创 2019-10-16 23:10:49 · 252 阅读 · 1 评论 -
URAL1517 Freedom of Choice 【后缀数组:最长公共连续子串】
Freedom of ChoiceTime limit: 2.0 secondMemory limit: 64 MBBackgroundBefore Albanian people could bear with the freedom of speech (this story is fully described in the problem “Freedom of speech”),...原创 2019-10-14 16:54:57 · 121 阅读 · 0 评论 -
POJ3294Life Forms【后缀数组】
DescriptionYou may have wondered why most extraterrestrial life forms resemble humans, differing by superficial traits such as height, colour, wrinkles, ears, eyebrows and the like. A few bear no hum...原创 2019-10-14 09:18:16 · 90 阅读 · 0 评论 -
P1207 [USACO1.2]双重回文数 Dual Palindromes
题目描述如果一个数从左往右读和从右往左读都是一样,那么这个数就叫做“回文数”。例如,12321就是一个回文数,而77778就不是。当然,回文数的首和尾都应是非零的,因此0220就不是回文数。事实上,有一些数(如21),在十进制时不是回文数,但在其它进制(如二进制时为10101)时就是回文数。编一个程序,从文件读入两个十进制数N (1 <= N <= 15)S (0 < S ...原创 2019-05-16 18:56:24 · 131 阅读 · 0 评论 -
Atlantis(POJ1151 )(扫描线+线段树+离散化)
AtlantisTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 29779 Accepted: 10606DescriptionThere are several ancient Greek texts that contain descriptions of the fabled island Atlantis. S...原创 2019-08-16 11:27:20 · 248 阅读 · 2 评论 -
HDU1166 敌兵布阵(简单树状数组)(简单线段树)
敌兵布阵Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 152393 Accepted Submission(s): 63266Problem DescriptionC国的死对头A国这段时间正在进行军事演习,所以C国间谍头子D...原创 2019-08-27 09:34:54 · 122 阅读 · 0 评论 -
HDU - 3450 - Counting Sequences (线段树|树状数组 + 离散化)
Problem Descriptionor a set of sequences of integers{a1,a2,a3,…an}, we define a sequence{ai1,ai2,ai3…aik}in which 1<=i1<i2<i3<…<ik<=n, as the sub-sequence of {a1,a2,a3,…an}. It is q...原创 2019-08-27 15:55:33 · 140 阅读 · 0 评论 -
Light bulbs(2019年亚洲区域(上海)网络赛B )
There are NN light bulbs indexed from 00 to N-1N−1. Initially, all of them are off.A FLIP operation switches the state of a contiguous subset of bulbs. FLIP(L, R)FLIP(L,R) means to flip all bulbs xx ...原创 2019-09-16 18:04:33 · 258 阅读 · 0 评论 -
Mayor's posters(线段树+离散化)
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-09-19 20:04:36 · 71 阅读 · 0 评论 -
题目整理
1.OJ题号:POJ1743简单题意:给你一个长为n的数字序列,要你求出该序列中最长的满足下面要求的序列长度:原序列中存在不重叠的两个序列,这两个序列长度相同且将第一个序列的所有数字加上某个常数可以得到第二个序列.正解思路:首先,根据height数组,将后缀分成若干组,使得每组后缀中,后缀之间的height值不小于k。这样分组之后,不难看出,如果某组后缀数量大于1,那么它们之中存在一个...原创 2019-09-27 23:05:41 · 231 阅读 · 0 评论 -
POJ 3693 Maximum repetition substring(后缀数组+ST)
DescriptionThe repetition number of a string is defined as the maximum number R such that the string can be partitioned into R same consecutive substrings. For example, the repetition number of “abab...原创 2019-09-30 18:22:36 · 119 阅读 · 0 评论 -
HDU 2665 Kth number(主席树)
Problem DescriptionGive you a sequence and ask you the kth big number of a inteval.InputThe first line is the number of the test cases.For each test case, the first line contain two integer n and ...原创 2019-09-30 18:58:56 · 76 阅读 · 0 评论 -
HDU 4080 Stammering Aliens(后缀数组+二分)
Description给出一个字符串,求这个字符串中重复次数不少于m次的最长字串长度以及这个子串在原串中最后一次出现的位置Input多组用例,每组用例第一行为一整数m,第二行为一长度不超过40000的字符串,以m=0结束输入Output输出两个整数,第一个整数为在这个字符串中重复次数不少于m次的最长子串的长度,第二个整数是这个子串在原串中最后一次出现的位置,如果不存在这样的子串则输出no...原创 2019-10-02 22:57:08 · 149 阅读 · 0 评论 -
BZOJ3261 最大异或和 可持久化trie
3261: 最大异或和Time Limit: 10 Sec Memory Limit: 512 MBSubmit: 4291 Solved: 1800[Submit][Status][Discuss]Description给定一个非负整数序列{a},初始长度为N。有M个操作,有以下两种操作类型:1、Ax:添加操作,表示在序列末尾添加一个数x,序列的长度N+1。2、Qlrx:询问...原创 2019-10-08 21:40:11 · 135 阅读 · 0 评论 -
Almost Arithmetical Progression(codeforces)(dp)
C. Almost Arithmetical Progressiontime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGena loves sequences of numbers. Recently, he has discovered...原创 2019-08-20 09:30:31 · 154 阅读 · 0 评论 -
数独(dfs)(POJ3074)
Language:SudokuTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 12243 Accepted: 4375DescriptionIn the game of Sudoku, you are given a large 9 × 9 grid divided into smaller 3 × 3 subgri...原创 2019-08-10 09:08:36 · 292 阅读 · 0 评论 -
Silent Classroom
There are nn students in the first grade of Nlogonia high school. The principal wishes to split the students into two classrooms (each student must be in exactly one of the classrooms). Two distinct s...原创 2019-05-18 00:45:25 · 174 阅读 · 0 评论 -
codeforces All the Vowels Please
Tom loves vowels, and he likes long words with many vowels. His favorite words are vowelly words. We say a word of length kk is vowelly if there are positive integers nn and mm such that n⋅m=kn⋅m=k an...原创 2019-05-18 00:42:47 · 344 阅读 · 1 评论 -
P1211 [USACO1.3]牛式 Prime Cryptarithm
题目描述下面是一个乘法竖式,如果用我们给定的那n个数字来取代*,可以使式子成立的话,我们就叫这个式子牛式。 ***x ** *** *** ****(请复制到记事本)数字只能取代*,当然第一位不能为0,况且给定的数字里不包括0。注意一下在美国的学校中教的“部分乘积”,第一部分乘积是第二个数的个位和第一个数的积,第二部分乘积是第二个数...原创 2019-05-17 18:50:36 · 137 阅读 · 0 评论 -
P1209 [USACO1.3]修理牛棚 Barn Repair
题目描述在一个夜黑风高,下着暴风雨的夜晚,farmer John的牛棚的屋顶、门被吹飞了。 好在许多牛正在度假,所以牛棚没有住满。 牛棚一个紧挨着另一个被排成一行,牛就住在里面过夜。 有些牛棚里有牛,有些没有。 所有的牛棚有相同的宽度。 自门遗失以后,farmer John必须尽快在牛棚之前竖立起新的木板。 他的新木材供应商将会供应他任何他想要的长度,但是吝啬的供应商只能提供有限数目的木板。 f...原创 2019-05-17 10:33:20 · 336 阅读 · 0 评论 -
小希的迷宫(并查集)
上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走。但是她设计迷宫的思路不一样,首先她认为所有的通道都应该是双向连通的,就是说如果有一个通道连通了房间A和B,那么既可以通过它从房间A走到房间B,也可以通过它从房间B走到房间A,为了提高难度,小希希望任意两个房间有且仅有一条路径可以相通(除非走了回头路)。小希现在把她的设计图给你,让你帮忙判断她的...原创 2019-05-26 11:32:10 · 129 阅读 · 0 评论 -
P3864 [USACO1.2]命名那个数字 Name That Number
在威斯康辛州牛守志大农场经营者之中,都习惯于请会计部门用连续数字给母牛打上烙印。但是,母牛本身并没感到这个系统的便利,它们更喜欢用它们喜欢的名字来呼叫它们的同伴,而不是用像这个的语句"C’mon, #4364, get along."。请写一个程序来帮助可怜的牧牛工将一只母牛的烙印编号翻译成一个可能的名字。因为母牛们现在都有手机了,使用标准的按键的排布来把将数目翻译为文字:( 除了 “Q” 和 “...原创 2019-05-16 18:54:04 · 233 阅读 · 0 评论 -
洛谷p1202(usaco1.1) 黑色星期五
题目描述13号又是一个星期五。13号在星期五比在其他日子少吗?为了回答这个问题,写一个程序,要求计算每个月的十三号落在周一到周日的次数。给出N年的一个周期,要求计算1900年1月1日至1900+N-1年12月31日中十三号落在周一到周日的次数,N为正整数且不大于400.这里有一些你要知道的:1、1900年1月1日是星期一.2、4,6,11和9月有30天.其他月份除了2月都有31天.闰年2月...原创 2019-05-16 18:51:13 · 139 阅读 · 0 评论 -
hdu 3790 最短路径问题(距离和费用)
给你n个点,m条无向边,每条边都有长度d和花费p,给你起点s终点t,要求输出起点到终点的最短距离及其花费,如果最短距离有多条路线,则输出花费最少的。Input输入n,m,点的编号是1~n,然后是m行,每行4个数 a,b,d,p,表示a和b之间有一条边,且其长度为d,花费为p。最后一行是两个数 s,t;起点s,终点。n和m为0时输入结束。(1<n<=1000, 0<m<...原创 2019-05-25 10:01:00 · 162 阅读 · 0 评论 -
expanding rod(二分+数学公式)
When a thin rod of length L is heated n degrees, it expands to a new length L’=(1+n*C)*L, where C is the coefficient of heat expansion.When a thin rod is mounted on two solid walls and then heated, i...原创 2019-05-05 10:51:42 · 342 阅读 · 0 评论 -
Blackboard Fibonacci
Fibonacci numbers are the sequence of integers: f0 = 0, f1 = 1, f2 = 1, f3 = 2, f4 = 3, f5 = 5, …, fn = fn - 2 + fn - 1. So every next number is the sum of the previous two.Bajtek has developed a nic...原创 2019-07-23 16:55:35 · 190 阅读 · 0 评论 -
Little Elephant and Array
B. Little Elephant and Arraytime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe Little Elephant loves playing with arrays. He has array a, co...原创 2019-07-24 09:14:46 · 169 阅读 · 0 评论 -
约数之和(sumdiv)
假设现在有两个自然数A和B,S是AB的所有约数之和。请你求出S mod 9901的值是多少。输入格式在一行中输入用空格隔开的两个整数A和B。输出格式输出一个整数,代表S mod 9901的值。数据范围0≤A,B≤5×107输入样例:2 3输出样例:15注意: A和B不会同时为0。思路:把A分解质因数,表示为p1^c1 * p2^c2 * …pn^cn。那么 A 表示为...原创 2019-08-07 10:31:11 · 656 阅读 · 0 评论 -
费解的开关
https://www.acwing.com/problem/content/97/思路:在上述规则的01矩阵的点击游戏中,很容易发现三个性质:1.每个位置至多会被点击一次2.若固定了第一行,则满足题意的点击方案至多只有一种。其原因是:当第i行某一位为1时,若前i行被固定,只等点击第i+1行该位置上的数字才能使第i行的这一位改变状态。3.点击的先后顺序不影响最终结果。对第一行的点击方案...原创 2019-08-06 10:59:04 · 96 阅读 · 0 评论 -
Well-known Numbers(CodeForces - 225B )
Well-known Numberstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputNumbers k-bonacci (k is integer, k > 1) are a generalization of Fibonacc...原创 2019-07-28 16:01:21 · 142 阅读 · 0 评论 -
Snowflake Snow Snowflakes(POJ3349)(哈希)
Snowflake Snow SnowflakesTime Limit: 4000MS Memory Limit: 65536KTotal Submissions: 53447 Accepted: 13800DescriptionYou may have heard that no two snowflakes are alike. Your task is to write a pr...原创 2019-08-01 15:49:45 · 120 阅读 · 0 评论 -
Bracket Sequence(CodeForces - 224C )
C. Bracket Sequencetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA bracket sequence is a string, containing only characters “(”, “)”, “[” a...原创 2019-07-27 11:15:18 · 241 阅读 · 0 评论