![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Codeforces
文章平均质量分 86
无
lwz_159
原acmer(已退役)
展开
-
#757 (Div. 2) D. Divan and Kostomuksha(约数+dp)
题目描述This is the hard version of the problem. The only difference is maximum value of ai.Once in Kostomuksha Divan found an array a consisting of positive integers. Now he wants to reorder the elements of a to maximize the value of the following function原创 2021-11-27 16:47:12 · 624 阅读 · 0 评论 -
#757 (Div. 2) C. Divan and bitwise operations(组合数字+位运算)
题目描述Once Divan analyzed a sequence a1,a2,…,an consisting of n non-negative integers as follows. He considered each non-empty subsequence of the sequence a, computed the bitwise XOR of its elements and added up all the XORs, obtaining the coziness of the原创 2021-11-27 12:42:09 · 416 阅读 · 0 评论 -
#722 (Div. 1) B. Kavi on Pairing Duty(DP)
题目描述Kavi has 2n points lying on the OX axis, i-th of which is located at x=i.Kavi considers all ways to split these 2n points into n pairs. Among those, he is interested in good pairings, which are defined as follows:Consider n segments with ends at th原创 2021-10-26 23:24:53 · 417 阅读 · 0 评论 -
#736 (Div. 2) C. Web of Lies(图论)
题目描述There are n nobles, numbered from 1 to n. Noble i has a power of i. There are also m “friendships”. A friendship between nobles a and b is always mutual.A noble is defined to be vulnerable if both of the following conditions are satisfied:the noble原创 2021-08-02 10:22:08 · 169 阅读 · 0 评论 -
Educational Codeforces Round 112 (Rated for Div. 2) B. Two Tables
题目描述You have an axis-aligned rectangle room with width W and height H, so the lower left corner is in point (0,0) and the upper right corner is in (W,H).There is a rectangular table standing in this room. The sides of the table are parallel to the walls原创 2021-07-31 11:09:27 · 128 阅读 · 0 评论 -
The 17th Zhejiang Provincial Contest E. Easy DP Problem(主席树)
题目描述题目链接题目大意给你一个序列a[],以及q个查询。对于每个查询,给出l,r,k,要求以a[l-r]作为b[]数组求出 dp[r-l+1][k]的值。题目分析代码如下原创 2021-05-07 23:49:46 · 237 阅读 · 0 评论 -
The 13th Chinese Northeast Contest B. Balanced Diet(前缀和)
题目描述Taylor is wandering in a milk candy store. The store has m types of sweets and there are n sweets in the store. The i-th sweet has the value of ai, and it is of type bi.Taylor is planning to buy some sweets in the store, each sweet can be bought at原创 2021-05-07 17:06:16 · 264 阅读 · 1 评论 -
The 13th Chinese Northeast Contest C. Line-line Intersection(平面几何)
题目描述There are n lines l1,l2,…,ln on the 2D-plane.Staring at these lines, Calabash is wondering how many pairs of (i,j) that 1≤i<j≤n and li,lj share at least one common point. Note that two overlapping lines also share common points.Please write a pr原创 2021-05-07 15:59:32 · 309 阅读 · 0 评论 -
The 13th Chinese Northeast Contest H. Skyscraper(差分+树状数组)
题目描述At the main street of Byteland, there will be built n skyscrapers, standing sequentially one next to other. If look leftside right, sequence of their height will be a1,a2,…,an.Initially the street is empty, every skyscraper’s height is 0. Hamster is原创 2021-05-06 20:44:35 · 247 阅读 · 0 评论 -
The 17th Zhejiang Provincial Contest B. Bin Packing Problem(线段树+map)
题目描述Lzw is having the Operations Research class now. Today the teacher is talking about the bin packing problem and some approximation algorithms to solve it.In the bin packing problem, items of different volumes must be packed into a finite number of b原创 2021-05-06 19:56:47 · 332 阅读 · 0 评论 -
2020-2021 “Orz Panda” Cup A. Accordion Artist And Orz Pandas(单调栈)
题目描述Chuan the Country Builder is a famous accordion artist. Now he wants to put a “Make Accordion Great Again” advertisment, in order to get some advantage over his enemy Bai the Sleeper.There are n buildings on the 114514th Avenue, the Old York city. T原创 2021-05-06 18:01:04 · 346 阅读 · 4 评论 -
Educational Codeforces Round 93 (Rated for Div. 2) C. Good Subarrays(前缀和优化技巧)
题目描述You are given an array a1,a2,…,an consisting of integers from 0 to 9. A subarray al,al+1,al+2,…,ar−1,ar is good if the sum of elements of this subarray is equal to the length of this subarray (∑i=lrai=r−l+1).For example, if a=[1,2,0], then there are原创 2021-05-02 10:53:02 · 323 阅读 · 0 评论 -
#702 (Div. 3)G. Old Floppy Drive(前缀和+二分)
题目描述Polycarp was dismantling his attic and found an old floppy drive on it. A round disc was inserted into the drive with n integers written on it.Polycarp wrote the numbers from the disk into the a array. It turned out that the drive works according to原创 2021-05-01 20:55:40 · 297 阅读 · 0 评论 -
#688 (Div. 2) C. Triangles(枚举,思维)
题目描述Gildong has a square board consisting of n rows and n columns of square cells, each consisting of a single digit (from 0 to 9). The cell at the j-th column of the i-th row can be represented as (i,j), and the length of the side of each cell is 1. Gil原创 2021-03-06 15:04:46 · 301 阅读 · 0 评论 -
Codeforces Global Round 12 D. Rating Compression(思维)
题目描述On the competitive programming platform CodeCook, every person has a rating graph described by an array of integers a of length n. You are now updating the infrastructure, so you’ve created a program to compress these graphs.The program works as fol原创 2021-03-01 22:32:07 · 244 阅读 · 0 评论 -
Codeforces Global Round 13 C. Pekora and Trampoline(贪心)
题目描述There is a trampoline park with n trampolines in a line. The i-th of which has strength Si.Pekora can jump on trampolines in multiple passes. She starts the pass by jumping on any trampoline of her choice.If at the moment Pekora jumps on trampoline原创 2021-03-01 16:32:17 · 2186 阅读 · 4 评论 -
Codeforces Global Round 13 D. Zookeeper and The Infinite Zoo(思维,位运算)
题目描述There is a new attraction in Singapore Zoo: The Infinite Zoo.The Infinite Zoo can be represented by a graph with an infinite number of vertices labeled 1,2,3,…. There is a directed edge from vertex u to vertex u+v if and only if u&v=v, where &am原创 2021-03-01 08:20:15 · 2509 阅读 · 10 评论 -
Codeforces Global Round 12 C2. Errich-Tac-Toe (Hard Version)(思维)
题目描述The only difference between the easy and hard versions is that tokens of type O do not appear in the input of the easy version.Errichto gave Monogon the following challenge in order to intimidate him from taking his top contributor spot on Codeforce原创 2021-02-28 20:44:16 · 70444 阅读 · 0 评论 -
#691 (Div. 2) C. Row GCD(最大公约数的性质)
题目描述You are given two positive integer sequences a1,…,an and b1,…,bm. For each j=1,…,m find the greatest common divisor of a1+bj,…,an+bj.InputThe first line contains two integers n and m (1≤n,m≤2⋅105).The second line contains n integers a1,…,an (1≤a原创 2021-02-23 11:21:23 · 260 阅读 · 0 评论 -
Good Bye 2020 F. Euclid‘s nightmare(图论,并查集)
题目描述You may know that Euclid was a mathematician. Well, as it turns out, Morpheus knew it too. So when he wanted to play a mean trick on Euclid, he sent him an appropriate nightmare.In his bad dream Euclid has a set S of n m-dimensional vectors over the原创 2021-02-22 23:12:42 · 293 阅读 · 0 评论 -
#703 (Div. 2)D. Max Median(二分)
题目描述You are a given an array a of length n. Find a subarray a[l…r] with length at least k with the largest median.A median in an array of length n is an element which occupies position number ⌊n+12⌋ after we sort the elements in non-decreasing order. Fo原创 2021-02-22 11:01:40 · 354 阅读 · 0 评论 -
Good Bye 2020 E. Apollo versus Pan(位运算)
题目描述Only a few know that Pan and Apollo weren’t only battling for the title of the GOAT musician. A few millenniums later, they also challenged each other in math (or rather in fast calculations). The task they got to solve is the following:Let x1,x2,…,原创 2021-02-22 10:32:25 · 288 阅读 · 0 评论 -
Codeforces Round #692 (Div. 2) C. Peaceful Rooks(图论,并查集)
题目描述You are given a n×n chessboard. Rows and columns of the board are numbered from 1 to n. Cell (x,y) lies on the intersection of column number x and row number y.Rook is a chess piece, that can in one turn move any number of cells vertically or horizo原创 2021-02-21 23:13:26 · 439 阅读 · 0 评论 -
#701 (Div. 2)C. Floor and Mod(数学)
题目描述A pair of positive integers (a,b) is called special if ⌊ab⌋=amodb. Here, ⌊ab⌋ is the result of the integer division between a and b, while amodb is its remainder.You are given two integers x and y. Find the number of special pairs (a,b) such that 1≤原创 2021-02-16 12:01:56 · 396 阅读 · 3 评论 -
#700 (Div. 2)D1. Painting the Array I(贪心)
题目描述The only difference between the two versions is that this version asks the maximal possible answer.Homer likes arrays a lot. Today he is painting an array a1,a2,…,an with two kinds of colors, white and black. A painting assignment for a1,a2,…,an is原创 2021-02-13 23:31:07 · 545 阅读 · 0 评论 -
#700 (Div. 2)C. Searching Local Minimum(二分的神奇用法+交互)
题目描述This is an interactive problem.Homer likes arrays a lot and he wants to play a game with you.Homer has hidden from you a permutation a1,a2,…,an of integers 1 to n. You are asked to find any index k (1≤k≤n) which is a local minimum.For an array a1,原创 2021-02-08 11:06:56 · 651 阅读 · 6 评论 -
Educational Codeforces Round 103 (Rated for Div. 2)D. Journey(dp)
题目描述There are n+1 cities, numbered from 0 to n. n roads connect these cities, the i-th road connects cities i−1 and i (i∈[1,n]).Each road has a direction. The directions are given by a string of n characters such that each character is either L or R. If原创 2021-01-31 09:49:10 · 354 阅读 · 0 评论 -
Educational Codeforces Round 103 (Rated for Div. 2)C. Longest Simple Cycle(贪心)
题目描述You have n chains, the i-th chain consists of ci vertices. Vertices in each chain are numbered independently from 1 to ci along the chain. In other words, the i-th chain is the undirected graph with ci vertices and (ci−1) edges connecting the j-th an原创 2021-01-30 10:51:07 · 455 阅读 · 1 评论 -
#698 (Div. 2)B. Nezzar and Lucky Number(数学)
题目描述Nezzar’s favorite digit among 1,…,9 is d. He calls a positive integer lucky if d occurs at least once in its decimal representation.Given q integers a1,a2,…,aq, for each 1≤i≤q Nezzar would like to know if ai can be equal to a sum of several (one or原创 2021-01-29 20:41:47 · 297 阅读 · 0 评论 -
#698 (Div. 2)C. Nezzar and Symmetric Array(数学)
题目描述Long time ago there was a symmetric array a1,a2,…,a2n consisting of 2n distinct integers. Array a1,a2,…,a2n is called symmetric if for each integer 1≤i≤2n, there exists an integer 1≤j≤2n such that ai=−aj.For each integer 1≤i≤2n, Nezzar wrote down an原创 2021-01-29 16:22:52 · 337 阅读 · 0 评论 -
#696 (Div. 2)D. Cleaning(思维)
题目描述During cleaning the coast, Alice found n piles of stones. The i-th pile has ai stones.Piles i and i+1 are neighbouring for all 1≤i≤n−1. If pile i becomes empty, piles i−1 and i+1 doesn’t become neighbouring.Alice is too lazy to remove these stones,原创 2021-01-21 22:19:26 · 270 阅读 · 0 评论 -
#696 (Div. 2)C. Array Destruction(贪心+set的应用)
题目描述You found a useless array a of 2n positive integers. You have realized that you actually don’t need this array, so you decided to throw out all elements of a.It could have been an easy task, but it turned out that you should follow some rules:In th原创 2021-01-20 10:00:44 · 1102 阅读 · 0 评论 -
Educational Codeforces Round 95 (Rated for Div. 2)D. Trash Problem(权值线段树+离散化)
题目描述Vova decided to clean his room. The room can be represented as the coordinate axis OX. There are n piles of trash in the room, coordinate of the i-th pile is the integer pi. All piles have different coordinates.Let’s define a total cleanup as the fo原创 2020-09-16 08:01:49 · 379 阅读 · 0 评论 -
Educational Codeforces Round 95 (Rated for Div. 2)C. Mortal Kombat Tower(状态机dp)
题目描述You and your friend are playing the game Mortal Kombat XI. You are trying to pass a challenge tower. There are n bosses in this tower, numbered from 1 to n. The type of the i-th boss is ai. If the i-th boss is easy then its type is ai=0, otherwise th原创 2020-09-15 10:43:29 · 399 阅读 · 0 评论 -
#665 (Div. 2)D. Maximum Distributed Tree(贪心)
题目描述You are given a tree that consists of n nodes. You should label each of its n−1 edges with an integer in such way that satisfies the following conditions:each integer must be greater than 0;the product of all n−1 numbers should be equal to k;the n原创 2020-09-10 11:15:10 · 262 阅读 · 0 评论 -
#665 (Div. 2)C. Mere Array(思维)
题目描述You are given an array a1,a2,…,an where all ai are integers and greater than 0.In one operation, you can choose two different indices i and j (1≤i,j≤n). If gcd(ai,aj) is equal to the minimum element of the whole array a, you can swap ai and aj. gcd(原创 2020-09-09 12:41:26 · 355 阅读 · 0 评论 -
#663 (Div. 2)C. Cyclic Permutations(数学)
题目描述A permutation of length n is an array consisting of n distinct integers from 1 to n in arbitrary order. For example, [2,3,1,5,4] is a permutation, but [1,2,2] is not a permutation (2 appears twice in the array) and [1,3,4] is also not a permutation (原创 2020-08-10 11:15:43 · 443 阅读 · 1 评论 -
#662 (Div. 2)B. Applejack and Storages
题目描述This year in Equestria was a year of plenty, so Applejack has decided to build some new apple storages. According to the advice of the farm designers, she chose to build two storages with non-zero area: one in the shape of a square and another one in原创 2020-08-08 14:56:52 · 378 阅读 · 0 评论 -
#659 (Div. 2) B. Koa and the Beach (Easy Version DP&&Hard Version 贪心)
题目描述The only difference between easy and hard versions is on constraints. In this version constraints are higher. You can make hacks only if all versions of the problem are solved.Koa the Koala is at the beach!The beach consists (from left to right) of原创 2020-07-25 11:45:31 · 1375 阅读 · 0 评论 -
#659 (Div. 2) C. String Transformation 1(贪心)
题目描述Note that the only difference between String Transformation 1 and String Transformation 2 is in the move Koa does. In this version the letter y Koa selects must be strictly greater alphabetically than x (read statement for better understanding). You原创 2020-07-25 10:17:40 · 656 阅读 · 0 评论