自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 Codeforces Global Round 18 C. Menorah

There are nnn candles on a Hanukkah menorah, and some of its candles are initially lit. We can describe which candles are lit with a binary string sss, where the iii-th candle is lit if and only if si=1s_i=1si​=1.Initially, the candle lights are described

2024-06-14 14:11:19 117

原创 Codeforces Round 614 (Div. 1) B. Aroma‘s Search

With a new body, our idol Aroma White (or should we call her Kaori Minamiya?) begins to uncover her lost past through the OS space.The space can be considered a 2D plane, with an infinite number of data nodes, indexed from 000, with their coordinates defin

2024-06-13 12:08:12 437

原创 Codeforces Round 952 (Div. 4)

此解法时间复杂度为。

2024-06-12 09:42:30 640

原创 Educational Codeforces Round 33 D. Credit Card

Recenlty Luba got a credit card and started to use it. Let’s consider nnn consecutive days Luba uses the card.She starts with 000 money on her account.In the evening of iii-th day a transaction aia_iai​ occurs. If ai > 0a_i > 0ai​ > 0, then aia_iai​ bourle

2024-06-11 17:18:56 282

原创 VK Cup 2015 - Round 1 C. The Art of Dealing with ATM

ATMs of a well-known bank of a small country are arranged so that they can not give any amount of money requested by the user. Due to the limited size of the bill dispenser (the device that is directly giving money from an ATM) and some peculiarities of th

2024-06-10 23:51:17 868

原创 Codeforces Round 460 (Div. 2) D. Substring

You are given a graph with nnn nodes and mmm directed edges. One lowercase letter is assigned to each node. We define a path’s value as the number of the most frequently occurring letter. For example, if letters on a path are “abaca”, then the value of tha

2024-06-09 00:37:35 859

原创 Mail.Ru Cup 2018 Round 3 B. Divide Candies

Arkady and his friends love playing checkers on an n×nn \times nn×n field. The rows and the columns of the field are enumerated from 111 to nnn.The friends have recently won a championship, so Arkady wants to please them with some candies. Remembering an o

2024-06-08 20:02:44 714

原创 Codeforces Round 689 (Div. 2, based on Zed Code Competition) D. Divide and Summarize

Mike received an array aaa of length nnn as a birthday present and decided to test how pretty it is.An array would pass the iii-th prettiness test if there is a way to get an array with a sum of elements totaling sis_isi​, using some number (possibly zero)

2024-06-07 14:56:25 803

原创 Codeforces Round 740 (Div. 2, based on VK Cup 2021 - Final (Engine)) D2. Up the Strip

108m109;

2024-06-06 13:30:18 575

原创 Codeforces Round 744 (Div. 3) E2. Array Optimization by Deque

In fact, the problems E1 and E2 do not have much in common. You should probably think of them as two separate problems.You are given an integer array a[1…n]=[a1,a2,…,an]a[1 \ldots n] = [a_1, a_2, \ldots, a_n]a[1…n]=[a1​,a2​,…,an​].Let us consider an empty

2024-06-05 23:59:55 720

原创 Codeforces Round 950 (Div. 3) A B C D E

Vlad is planning to hold mmm rounds next month. Each round should contain one problem of difficulty levels ‘A’, ‘B’, ‘C’, ‘D’, ‘E’, ‘F’, and ‘G’.Vlad already has a bank of nnn problems, where the iii-th problem has a difficulty level of aia_iai​. There may

2024-06-04 18:32:04 1309

原创 European Championship 2024 I. Disks

You are given nnn disks in the plane. The center of each disk has integer coordinates, and the radius of each disk is a positive integer. No two disks overlap in a region of positive area, but it is possible for disks to be tangent to each other.Your task

2024-06-04 11:42:23 922

原创 Helvetic Coding Contest 2017 B. Heidi and Library (medium)

Your search for Heidi is over – you finally found her at a library, dressed up as a human. In fact, she has spent so much time there that she now runs the place! Her job is to buy books and keep them at the library so that people can borrow and read them.

2024-06-03 17:44:21 913

原创 01-regression

/ 定义:由多段锯齿状的线段所组成的线⇒ 可以看作是一个常数,再加上一堆蓝色的 Function(Hard Sigmoid)

2024-06-03 14:39:54 1013

原创 Codeforces Round 548 (Div. 2) C. Edgy Trees

You are given a tree (a connected undirected graph without cycles) of nnn vertices. Each of the n−1n - 1n−1 edges of the tree is colored in either black or red.You are also given an integer kkk. Consider sequences of kkk vertices. Let’s call a sequence [a1

2024-06-02 09:48:50 1278

原创 CodeCraft-21 and Codeforces Round 711 (Div. 2) C. Planar Reflections

Gaurang has grown up in a mystical universe. He is faced by nnn consecutive 2D planes. He shoots a particle of decay age kkk at the planes.A particle can pass through a plane directly, however, every plane produces an identical copy of the particle going i

2024-06-01 18:57:56 815

原创 Educational Codeforces Round 127 D. Insert a Progression

You are given a sequence of nnn integers a1,a2,…,ana_1, a_2, \dots, a_na1​,a2​,…,an​. You are also given xxx integers 1,2,…,x1, 2, \dots, x1,2,…,x.You are asked to insert each of the extra integers into the sequence aaa. Each integer can be inserted at the

2024-05-31 10:46:18 1227

原创 Educational Codeforces Round 72 C. The Number Of Good Substrings

You are given a binary string sss (recall that a string is binary if each character is either 000 or 111).Let f(t)f(t)f(t) be the decimal representation of integer ttt written in binary form (possibly with leading zeroes). For example f(011)=3,f(00101)=5,f

2024-05-30 16:42:49 694

原创 Codeforces Global Round 3 C. Crazy Diamond

You are given a permutation ppp of integers from 111 to nnn, where nnn is an even number.Your goal is to sort the permutation. To do so, you can perform zero or more operations of the following type:There is no need to minimize the number of operations, ho

2024-05-29 19:28:37 952

原创 Codeforces Round 439 (Div. 2) C. The Intriguing Obsession

With hands joined, go everywhere at a speed faster than our thoughts! This time, the Fire Sisters — Karen and Tsukihi — is heading for somewhere they’ve never reached — water-surrounded islands!There are three clusters of islands, conveniently coloured red

2024-05-28 15:50:25 1035

原创 Educational Codeforces Round 164 D. Colored Balls

There are balls of nnn different colors; the number of balls of the iii-th color is aia_iai​.The balls can be combined into groups. Each group should contain at most 222 balls, and no more than 111 ball of each color.Consider all 2n2^n2n sets of colors. Fo

2024-05-27 15:54:25 813

原创 VK Cup 2015 - Round 2 E. Correcting Mistakes

Analyzing the mistakes people make while typing search queries is a complex and an interesting work. As there is no guaranteed way to determine what the user originally meant by typing some query, we have to use different sorts of heuristics.Polycarp neede

2024-05-26 12:00:00 959

原创 Educational Codeforces Round 42 D. Merge Equals

You are given an array of positive integers. While there are at least two equal elements, we will perform the following operation. We choose the smallest value xxx that occurs in the array 222 or more times. Take the first two occurrences of xxx in this ar

2024-05-25 10:16:08 236

原创 Codeforces Round 529 (Div. 3) D. Circular Dance

a21​1a22​4;a31​2a32​4;a41​1a42​5;

2024-05-24 10:57:35 294

原创 Codeforces Round 450 (Div. 2) C. Remove Extra One

You are given a permutation ppp of length nnn. Remove one element from permutation to make the number of records the maximum possible.We remind that in a sequence of numbers a1,a2,…,aka_1,a_2,\dots,a_ka1​,a2​,…,ak​ the element aia_iai​ is a record if for e

2024-05-23 16:56:05 946

原创 Educational Codeforces Round 61 C. Painting the Fence

You have a long fence which consists of nnn sections. Unfortunately, it is not painted, so you decided to hire qqq painters to paint it. iii-th painter will paint all sections xxx such that li≤x≤ril_i \le x \le r_ili​≤x≤ri​.Unfortunately, you are on a tigh

2024-05-22 15:04:17 298

原创 Codeforces Round 946 (Div. 3) A B C D E G

y2×2cells;

2024-05-21 04:30:00 1534

原创 Codeforces Round 459 (Div. 1) A. The Monster

()??output7ss。

2024-05-20 14:06:37 561

原创 Mail.Ru Cup 2018 Round 3 D. Decorate Apple Tree

There is one apple tree in Arkady’s garden. It can be represented as a set of junctions connected with branches so that there is only one way to reach any junctions from any other one using branches. The junctions are enumerated from 111 to nnn, the juncti

2024-05-18 22:18:53 779

原创 Codeforces Round 505 C. Plasticine zebra

Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.Inspired by this adventure and an accidentally found plasticine pack (repre

2024-05-17 09:16:05 324

原创 Codeforces Round 474 C. Subsequence Counting

Pikachu had an array with him. He wrote down all the non-empty subsequences of the array on paper. Note that an array of size n has 2n−12^n-12n−1 non-empty subsequences in it.Pikachu being mischievous as he always is, removed all the subsequences in which

2024-05-16 22:35:34 311

原创 Educational Codeforces Round 161 (Rated for Div. 2) A B C

一条线段上有多个城市,每个城市有唯一的距离自己最近的一个城市,每个城市到达离自己最近的城市所需花费的金币个数是1,到达其他的城市所需花费的金币个数是|ai-aj|。组成三角形的条件是任意两边之和要大于第三边,那么不存在长度完全不相等的三条边组成三角形(两条较小的边之和不可能大于第三条边)。从城市x到城市y过程中不会折返,故分别从前往后和从后往前两个方向计算出从城市ai到城市aj可能会多被计算上的金币个数sum。有n根木棒,每根木棒的长度是2^ai,求出选择三根木棒使得他们可以组成三角形的方法的数量。

2024-01-19 15:53:43 377

原创 Codeforces Round 920 (Div. 3) A~D

贪心,首先将两个数组排序,对于某个数,如果要选择b数组中间的某个数,那么一定存在比bi大的数和比bi小的数,故从b数组两边选所得结果|ai-bi|一定最大。某人需要在n个时间点发短信,他的手机每一秒要消耗的电量是a,开关一次机消耗的电量是b,初始手机电量是f,判断他能否发完消息。给出两个只包含01的字符串a和b,求出将字符串a转换成字符串b所需要的最少次数,其中a中的1可以换位置,多余的1要去除。用pair存,按照a.ff排序,a[0].ss-a[1].ss即正方形的边长。

2024-01-16 17:33:57 421 1

原创 Codeforces Round 828 (Div. 3) A~E

因为x*y可以整除a*b,那么x*y可以整除a的因子*b的因子。故先将a的因子和b的因子两两组和相乘去重,因为要是ab的倍数,至少是ab,故tmp=ab/x,在a~c和b~d中分别找x和tmp的最小公倍数,找到即满足题意。rrrgg 循环遍历,两个g之间只记最远的那个r需要的秒数,其他r所需要的秒数一定小于该值(因为是顺序进行的)。给定a,b,c,d四个正整数(a<c和b<d),找出任意一对x和y,a<x<=c,b<y<=d且x*y能被a*b整除。两个操作,对给定字符串的奇数值上加x|偶数值上加x。

2024-01-11 17:04:08 358

原创 Codeforces Round 918 (Div. 4) A~E

cnt=3('A'=0 'B'-1 'C'-2) vector<string> s(4) 两侧循环(内外层各3次,内层flag判断,如果这层循环结束flag=true 输出char(‘A'+cnt))下一个是辅音,输出s[i]+'.';上一个是辅音,输出s[i];答案处理:set存,判断s[i]是否存在,存在输出yes 注意存在0情况!长度为n的字符串,奇数位果汁a喝,偶数位果汁b喝,要求得一个字序列使得a喝的量和b喝的量一样多。前缀和 s[i]=s[i-1]+(a[i]-奇数 -a[i]-偶数)

2024-01-09 18:13:04 462

原创 Codeforces Round 916 (Div. 3) --- A~E

a保留自己多的(选自己最多的色弹-no)->ai与bi的差值影响(no)->一个色要么我选要么你选,我先让你选我再看如果是我选我对结果的影响是多少(a-(ai+bi-2) b-(-ai-bi+2))【并不是答案!重复完成哪个任务可以任意从已经被完成的任务中选择->确定完成到哪个任务结束(所有题目都是要求一个确定的边界 或者是一个公式来判断)一共有n种弹珠,a和b对于每个颜色分别有ai和bi个,a先(a弹出某个色的一个 b对应色的弹珠清零)ans=a珠子总数-b主子总数。最大完成任务数<=k。

2024-01-09 18:05:35 411

原创 牛客枚举-[NOIP2016]魔法阵

求每个值满足:xa<xb<xc<xd,xb-xa=2(xd-xc),xb-xa<(xc-xb)/3 时作为a,b,c,d物品的出现次数。d不断增大 对应一组唯一的ab,前一组的ab符合后一组cd。2.每个魔法值要组合起来 cnt*cnt (用map存)1.根据等式得出各数之间的关系-t和k处理 t-枚举。对应的a和b同理 最后直接输出答案。

2024-01-09 18:01:27 419

原创 8.27 849 (Div. 4)

1.负数的个数是偶数,可以通过操作使为0,sum为所有数的绝对值之和;emplace_back() 较push_back()性能up。检查所有分割点 由于只有26个英文字母所以不会超时 暴力。双指针 如果符合条件i++ j-- ans-=2;2.奇数个,选择绝对值最小的数+其他数的绝对值之和。当某个数为个位数时已经不需要再进行处理了 下标标记。将每个点所需的金币数存起来 排序 输出最多的个数。无论经过多少次运算,负数个数的奇偶性不会变。

2023-08-27 19:12:54 40

原创 8.25 Codeforces Round 827 (Div. 4)

分析:二分+前缀和 暴力会超时,可以用二分,构建两个数组,一个是a[i],作为前缀和数组,一个是f[i]表示第i个台阶之前的高度最大的台阶,然后每次二分来查找k,因为尽可能走的更多,所以查找有边界,最后输出对应的前缀和。分析:如果直接暴力 时间复杂度是O(2^n) 爆,所以贪心,将注意力放大每个数的值上去1000很小 所以每次记录某个数出现的最大的坐标,枚举1000*1000次 看这两个数是否存在和是否互质。因为你申请空间过大,会存在值为0的情况 排序直接会将0放在前面,判断时为false。

2023-08-25 12:26:03 95 1

原创 8.22 Codeforces Round 806 (Div. 4)

【代码】8.22 Codeforces Round 806 (Div. 4)

2023-08-23 19:19:47 42

空空如也

空空如也

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

TA关注的人

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