
Codeforce
♡-流浪孩
这个作者很懒,什么都没留下…
展开
-
Codeforces Round #688 (Div. 2) ------ Cancel the Trains
题目Gildong’s town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, and all trai原创 2020-12-05 09:48:12 · 534 阅读 · 0 评论 -
Educational Codeforces Round 99------Sequence and Swaps
题目You are given a sequence a consisting of n integers a1,a2,…,an, and an integer x. Your task is to make the sequence a sorted (it is considered sorted if the condition a1≤a2≤a3≤⋯≤an holds).To make the sequence sorted, you may perform the following opera原创 2020-12-01 17:20:05 · 176 阅读 · 0 评论 -
Educational Codeforces Round 99 ------ Ping-pong
题意Alice and Bob play ping-pong with simplified rules.During the game, the player serving the ball commences a play. The server strikes the ball then the receiver makes a return by hitting the ball back. Thereafter, the server and receiver must alternatel原创 2020-12-01 14:23:40 · 303 阅读 · 0 评论 -
Educational Codeforces Round 99 (Rated for Div. 2)------Jumps
题目You are standing on the OX-axis at point 0 and you want to move to an integer point x>0.You can make several jumps. Suppose you’re currently at point y (y may be negative) and jump for the k-th time. You can:either jump to the point y+kor jump to原创 2020-12-01 14:00:24 · 196 阅读 · 0 评论 -
Educational Codeforces Round 99 ------Strange Functions
题目Let’s define a function f(x) (x is a positive integer) as follows: write all digits of the decimal representation of x backwards, then get rid of the leading zeroes. For example, f(321)=123, f(120)=21, f(1000000)=1, f(111)=111.Let’s define another func原创 2020-12-01 13:27:15 · 213 阅读 · 0 评论 -
Codeforces Round #685 (Div. 2)------Non-Substring Subsequence
题目Hr0d1y has q queries on a binary string s of length n. A binary string is a string containing only characters ‘0’ and ‘1’.A query is described by a pair of integers li, ri (1≤li<ri≤n).For each query, he has to determine whether there exists a good原创 2020-11-28 09:18:47 · 198 阅读 · 0 评论 -
Codeforces Round #685 (Div. 2)------Subtract or Divide
题意给定一个数n,问让这个数从n到1需要几步操作。有以下两种操作方式:1、如果n > 1,n可以减12、除以一个能整除的数题解想一下就可以发现,除了1,2,3这三个数是特殊情况之外,其他的只有奇数和偶数,对于偶数,除以一个数,让它变为2,再减一,需要2步;对于奇数,先将它减一变成偶数,按偶数操作即可,需要3步AC代码#include<iostream>#include<algorithm>#include<queue>#include<ve原创 2020-11-28 08:27:11 · 156 阅读 · 0 评论 -
Educational Codeforces Round 98 (Rated for Div. 2)------Two Brackets
题目You are given a string s, consisting of brackets of two types: ‘(’, ‘)’, ‘[’ and ‘]’.A string is called a regular bracket sequence (RBS) if it’s of one of the following types:empty string;‘(’ + RBS + ‘)’;‘[’ + RBS + ‘]’;RBS + RBS.where plus is a c原创 2020-11-21 09:38:19 · 136 阅读 · 0 评论 -
Educational Codeforces Round 98 (Rated for Div. 2)------Toy Blocks
题目You are asked to watch your nephew who likes to play with toy blocks in a strange way.He has n boxes and the i-th box has ai blocks. His game consists of two steps:he chooses an arbitrary box i;he tries to move all blocks from the i-th box to other b原创 2020-11-21 09:30:18 · 265 阅读 · 0 评论 -
Educational Codeforces Round 98 (Rated for Div. 2)------Robot Program
题目There is an infinite 2-dimensional grid. The robot stands in cell (0,0) and wants to reach cell (x,y). Here is a list of possible commands the robot can execute:move north from cell (i,j) to (i,j+1);move east from cell (i,j) to (i+1,j);move south fro原创 2020-11-21 08:29:37 · 165 阅读 · 0 评论 -
Codeforces Round #672 (Div. 2)------Cubes Sorting
题目Wheatley decided to try to make a test chamber. He made a nice test chamber, but there was only one detail absent — cubes.For completing the chamber Wheatley needs n cubes. i-th cube has a volume ai.Wheatley has to place cubes in such a way that they原创 2020-11-10 14:34:29 · 118 阅读 · 0 评论 -
Educational Codeforces Round 97 (Rated for Div. 2)------Reverse Binary Strings
题目题意给你一个01字符串,可以对其中的一段进行翻转操作,问使字符串变成01交错的字符串至少需要多少次操作题解翻转字符串不会改变翻转区间内的01关系,只会改变头和尾的关系,交换找到相邻的相同的作为头,然后往后找第一个相邻的相同的且与头不相同的作为尾翻转第一种思想属于暴利,复杂度有点高,会被卡超时,因此介绍第二种思想第二种思想,多出来的连续的0或1的区间长度之和的最大值AC代码...原创 2020-11-07 09:44:17 · 164 阅读 · 0 评论 -
Educational Codeforces Round 97 (Rated for Div. 2)------Marketing Scheme
题目题意给定一个区间【l, r】,找出是否存在一个数a使得区间内所有数x满足x % a >= a / 2题解如果2 * l > r 即满足题意AC代码#include<stdio.h>int main(){ int t; scanf("%d", &t); while(t--){ int l, r; scanf("%d%d", &l, &r); if(2 * l > r)原创 2020-11-07 08:23:04 · 170 阅读 · 0 评论 -
Codeforces Round #681------The Delivery Dilemma
题目Petya is preparing for his birthday. He decided that there would be n different dishes on the dinner table, numbered from 1 to n. Since Petya doesn’t like to cook, he wants to order these dishes in restaurants.Unfortunately, all dishes are prepared in原创 2020-11-04 19:41:49 · 188 阅读 · 0 评论 -
Codeforces Round #681------Saving the City
题目Bertown is a city with n buildings in a straight line.The city’s security service discovered that some buildings were mined. A map was compiled, which is a string of length n, where the i-th character is “1” if there is a mine under the building number原创 2020-11-04 19:15:46 · 182 阅读 · 0 评论 -
Codeforces Round #681------Kids Seating
题目:Today the kindergarten has a new group of n kids who need to be seated at the dinner table. The chairs at the table are numbered from 1 to 4n. Two kids can’t sit on the same chair. It is known that two kids who sit on chairs with numbers a and b (a≠b)原创 2020-11-04 18:58:45 · 250 阅读 · 0 评论 -
Codeforces Round #678 (Div. 2)------Binary Search
题目Andrey thinks he is truly a successful developer, but in reality he didn’t know about the binary search algorithm until recently. After reading some literature Andrey understood that this algorithm allows to quickly find a certain number x in an array.原创 2020-10-31 10:25:00 · 244 阅读 · 0 评论 -
Codeforces Round #678 (Div. 2)------Prime Square
题目Sasha likes investigating different math objects, for example, magic squares. But Sasha understands that magic squares have already been studied by hundreds of people, so he sees no sense of studying them further. Instead, he invented his own type of sq原创 2020-10-31 08:50:01 · 248 阅读 · 0 评论 -
Codeforces Round #678 (Div. 2)------Reorder
题目For a given array a consisting of n integers and a given integer m find if it is possible to reorder elements of the array a in such a way thatIt is forbidden to delete elements as well as insert new elements. Please note that no rounding occurs during原创 2020-10-31 08:23:10 · 111 阅读 · 0 评论 -
Codeforces Round #669 (Div. 2) ------ Big Vova
题目题意给定你一个数组a,你可以对数组a进行重新排序,然后得到新的数组b,对数组b进行gcd,得到数组c,c[i] = gcd(b[1], b[2],b[i]),使得c数组是的字典序最大。求这样的数组b题解看数据范围之后,可以直接暴力。b数组第一个数为a数组中最大的数,后面的数是能使得其gcd最大的数,依次往下就好AC代码#include<iostream>#include<stdio.h>#include<algorithm>#include&l原创 2020-09-12 16:20:55 · 131 阅读 · 0 评论 -
Codeforces Round #669 (Div. 2) ------ Ahahahahahahahaha
题目题意给你一个长度为n的数组,数组元素由0或1构成,你可以进行随意的删除操作,一次只能删除一个元素,最多操作次数不能超过n / 2次。操作后的结果就是:奇数位数字之和等于偶数位数字之和。最后输出剩余的数组元素题解由于题目没有规定说删除次数最少,所以直接找出特殊情况。如果题目里面0的个数大于等于n / 2, 那么直接保留n / 2个0即可,其余的都删除如果题目里面1的个数大于等于n / 2且数目为偶数,那么直接保留所有1即可,其余0删除;如果是奇数,则保留num(1的数目) - 1个1,这样就原创 2020-09-12 10:48:13 · 226 阅读 · 0 评论 -
Codeforces Round #666 (Div. 2) ------ Stoned Game
题目T is playing a game with his friend, HL.There are n piles of stones, the i-th pile initially has ai stones.T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from i原创 2020-09-05 19:27:39 · 869 阅读 · 0 评论 -
Codeforces Round #666 (Div. 2) ------ Power Sequence
题目题意:给定一个长度为n的序列,可以进行两种操作,求使其变为最佳序列的最小花费操作一:排序,此操作没有花费操作二:对任意一个数无限制的进行加一或者减一操作,每次花费为1个单元最佳序列定义:a[i] = c^i,数组下标从0开始,即首项为1的等比数列题解:求出c的范围,暴力枚举即可。根据题目给出的数据范围,可知这个数组的最大和为1e14,然而等比数列的增长是非常快的,因此很快便会打到上界,所以最大公比为pow(1e14, 1.0 / n)AC代码:#include<iostrea原创 2020-09-05 16:29:36 · 188 阅读 · 0 评论 -
Codeforces Round #666 (Div. 2) ------ Multiples of Length
题目You are given an array a of n integers.You want to make all elements of a equal to zero by doing the following operation exactly three times:Select a segment, for each number in this segment we can add a multiple of len to it, where len is the length原创 2020-09-05 15:35:36 · 201 阅读 · 0 评论 -
Codeforces Round #633 (Div. 2)------(Powered Addition)
题目You have an array a of length n. For every positive integer x you are going to perform the following operation during the x-th second:Select some distinct indices i1,i2,…,ik which are between 1 an...原创 2020-04-27 14:21:14 · 188 阅读 · 0 评论 -
Codeforces Round #633 (Div. 2) ------ Filling Diamonds
题目You have integer n. Calculate how many ways are there to fully cover belt-like area of 4n−2 triangles with diamond shapes.Diamond shape consists of two triangles. You can move, rotate or flip the ...原创 2020-04-27 14:01:26 · 190 阅读 · 1 评论 -
Codeforces Round #633 (Div. 2) ------ Sorted Adjacent Differences
题目:You have array of n numbers a1,a2,…,an.Rearrange these numbers to satisfy |a1−a2|≤|a2−a3|≤…≤|an−1−an|, where |x| denotes absolute value of x. It’s always possible to find such rearrangement.Note...原创 2020-04-27 13:46:27 · 182 阅读 · 0 评论 -
Codeforces Round #628 (Div. 2)------Ehab the Xorcist
题目:Given 2 integers u and v, find the shortest array such that bitwise-xor of its elements is u, and the sum of its elements is v.InputThe only line contains 2 integers u and v (0≤u,v≤1018).Output...原创 2020-03-15 14:30:06 · 194 阅读 · 0 评论 -
Codeforces Round #628 (Div. 2)------Ehab and Path-etic MEXs
题目:You are given a tree consisting of n nodes. You want to write some labels on the tree’s edges such that the following conditions hold:Every label is an integer between 0 and n−2 inclusive.All th...原创 2020-03-15 14:06:43 · 287 阅读 · 0 评论 -
Codeforces Round #628 (Div. 2)------CopyCopyCopyCopyCopy
题目:Ehab has an array a of length n. He has just enough free time to make a new array consisting of n copies of the old array, written back-to-back. What will be the length of the new array’s longest ...原创 2020-03-15 13:07:35 · 394 阅读 · 0 评论 -
Codeforces Round #628 (Div. 2)------EhAb AnD gCd
题目:You are given a positive integer x. Find any such 2 positive integers a and b such that GCD(a,b)+LCM(a,b)=x.As a reminder, GCD(a,b) is the greatest integer that divides both a and b. Similarly, L...原创 2020-03-15 12:50:42 · 510 阅读 · 1 评论 -
Educational Codeforces Round 83 (Rated for Div. 2)------ Adding Powers
题目:Suppose you are performing the following algorithm. There is an array v1,v2,…,vn filled with zeroes at start. The following operation is applied to the array several times — at i-th step (0-indexe...原创 2020-03-10 18:24:08 · 138 阅读 · 0 评论 -
Educational Codeforces Round 83 (Rated for Div. 2)------Bogosort
题目:You are given an array a1,a2,…,an. Array is good if for each pair of indexes i<j the condition j−aj≠i−ai holds. Can you shuffle this array so that it becomes good? To shuffle an array means to ...原创 2020-03-10 18:02:04 · 172 阅读 · 0 评论 -
Educational Codeforces Round 83 (Rated for Div. 2)------Two Regular Polygons
题目:You are given two integers n and m (m<n). Consider a convex regular polygon of n vertices. Recall that a regular polygon is a polygon that is equiangular (all angles are equal in measure) and e...原创 2020-03-10 17:47:42 · 328 阅读 · 0 评论 -
Codeforces Round #626(Unusual Competitions)
题目:A bracketed sequence is called correct (regular) if by inserting “+” and “1” you can get a well-formed mathematical expression from it. For example, sequences “(())()”, “()” and “(()(()))” are cor...原创 2020-03-08 16:55:38 · 144 阅读 · 0 评论 -
Codeforces Round #626(Count Subrectangles)
题目:You are given an array a of length n and array b of length m both consisting of only integers 0 and 1. Consider a matrix c of size n×m formed by following rule: ci,j=ai⋅bj (i.e. ai multiplied by b...原创 2020-03-08 16:29:11 · 318 阅读 · 0 评论 -
Codeforces Round #619 (Ayoub's function)
题目:Ayoub thinks that he is a very smart person, so he created a function f(s), where s is a binary string (a string which contains only symbols “0” and “1”). The function f(s) is equal to the number ...原创 2020-02-14 21:22:03 · 205 阅读 · 0 评论 -
Codeforces Round #619 (Motarack's Birthday)
题目:Dark is going to attend Motarack’s birthday. Dark decided that the gift he is going to give to Motarack is an array a of n non-negative integers.Dark created that array 1000 years ago, so some el...原创 2020-02-14 21:14:32 · 285 阅读 · 0 评论 -
Codeforces Round #619 (Three Strings)
题目:You are given three strings a, b and c of the same length n. The strings consist of lowercase English letters only. The i-th letter of a is ai, the i-th letter of b is bi, the i-th letter of c is ...原创 2020-02-14 21:02:30 · 226 阅读 · 0 评论 -
CodeForces - 1144E(Median String )
题目:You are given two strings s and t, both consisting of exactly k lowercase Latin letters, s is lexicographically less than t.Let’s consider list of all strings consisting of exactly k lowercase La...原创 2020-02-05 13:36:18 · 241 阅读 · 0 评论