codeforces
龍木
若人生为棋,我愿为卒,漫漫征途,谁曾见我后退半步
展开
-
D. XOR-gun
https://codeforces.ml/contest/1457/problem/DArkady owns anon-decreasingarraya1,a2,…,ana1,a2,…,an. You are jealous of its beauty and want to destroy this property. You have a so-calledXOR-gunthat you can use one or more times.In one step you can se...原创 2020-11-29 18:36:22 · 394 阅读 · 1 评论 -
C. Bouncing Ball
https://codeforces.ml/contest/1457/problem/CYou're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from11, and in each cell you.原创 2020-11-29 17:21:20 · 290 阅读 · 0 评论 -
C. Sequence Transformation
https://codeforces.ml/contest/1454/problem/CYou are given a sequenceaa, initially consisting ofnnintegers.You want to transform this sequence so that all elements in itare equal(i.e. it contains several occurrences of the same element).To achie...原创 2020-11-25 15:12:51 · 482 阅读 · 0 评论 -
D. Number into Sequence
https://codeforces.ml/contest/1454/problem/DYou are given an integernn(n>1n>1).Your task is to find a sequence of integersa1,a2,…,aka1,a2,…,aksuch that:eachaiaiis strictly greater than11; a1⋅a2⋅…⋅ak=na1⋅a2⋅…⋅ak=n(i.e. the product of t...原创 2020-11-25 15:11:08 · 563 阅读 · 2 评论 -
C. ABBB
https://codeforces.ml/contest/1428/problem/CZookeeper is playing a game. In this game, Zookeeper must use bombs to bomb a string that consists of letters 'A' and 'B'. He can use bombs to bomb a substring which is either "AB" or "BB". When he bombs such a原创 2020-11-24 15:11:57 · 472 阅读 · 0 评论 -
B. Toy Blocks
https://codeforces.ml/contest/1452/problem/BYou are asked to watch your nephew who likes to play with toy blocks in a strange way.He hasnnboxes and theii-th box hasaiaiblocks. His game consists of two steps:he chooses an arbitrary boxii; he tr...原创 2020-11-23 17:04:48 · 286 阅读 · 1 评论 -
D. Radio Towers
https://codeforces.ml/contest/1452/problem/DThere aren+2n+2towns located on a coordinate line, numbered from00ton+1n+1. Theii-th town is located at the pointii.You build a radio tower in each of the towns1,2,…,n1,2,…,nwith probability1212(th...原创 2020-11-23 17:03:48 · 350 阅读 · 0 评论 -
C. String Equality
https://codeforces.com/contest/1451/problem/CAshish has two stringsaaandbb, each of lengthnn, and an integerkk. The strings only contain lowercase English letters.He wants to convert stringaainto stringbbby performing some (possibly zero) oper...原创 2020-11-22 14:37:39 · 329 阅读 · 1 评论 -
C. k-Amazing Numbers
https://codeforces.ml/contest/1417/problem/CYou are given an arrayaaconsisting ofnnintegers numbered from11tonn.Let's define thekk-amazing number of the array as the minimum number that occurs in all of the subsegments of the array having lengt...原创 2020-11-19 14:29:07 · 270 阅读 · 0 评论 -
B. Sum of Medians
https://codeforces.ml/contest/1440/problem/BAmedianof an array of integers of lengthnnis the number standing on the⌈n2⌉⌈n2⌉(rounding up) position in the non-decreasing ordering of its elements. Positions are numbered starting with11. For example, ...原创 2020-11-18 14:12:58 · 335 阅读 · 0 评论 -
C2. Binary Table (Hard Version)
https://codeforces.ml/contest/1440/problem/C2This is the hard version of the problem. The difference between the versions is in the number of possible operations that can be made. You can make hacks if and only if you solved both versions of the problem.原创 2020-11-18 13:52:37 · 323 阅读 · 0 评论 -
D. Catching Cheaters
https://codeforces.ml/contest/1447/problem/DYou are given two stringsAAandBBrepresenting essays of two students who are suspected cheaters. For any two stringsCC,DDwe define their similarity scoreS(C,D)S(C,D)as4⋅LCS(C,D)−|C|−|D|4⋅LCS(C,D)−|C|−|...原创 2020-11-16 19:42:46 · 240 阅读 · 0 评论 -
C. Knapsack
https://codeforces.ml/contest/1447/problem/CYou have a knapsack with the capacity ofWW. There are alsonnitems, theii-th one has weightwiwi.You want to put some of these items into the knapsack in such a way that their total weightCCis at least h...原创 2020-11-16 18:35:16 · 268 阅读 · 0 评论 -
C. Engineer Artem
https://codeforces.ml/contest/1438/problem/CArtem is building a new robot. He has a matrixaaconsisting ofnnrows andmmcolumns. The cell located on theii-th row from the top and thejj-th column from the left has a valueai,jai,jwritten in it.If ...原创 2020-11-14 14:22:31 · 209 阅读 · 0 评论 -
D. Minimal Height Tree
https://codeforces.ml/contest/1437/problem/DMonocarp had a tree which consisted ofnnvertices and was rooted at vertex11. He decided to study BFS (Breadth-first search), so he ran BFS on his tree, starting from the root. BFS can be described by the fol...原创 2020-11-06 14:41:55 · 210 阅读 · 0 评论 -
C. Chef Monocarp
Chef Monocarp has just putnndishes into an oven. He knows that theii-th dish has its optimal cooking time equal totitiminutes.At anypositive integerminuteTTMonocarp can putno more than onedish out of the oven. If theii-th dish is put out at s...原创 2020-11-06 14:40:36 · 242 阅读 · 0 评论 -
C. Division
https://codeforces.ml/contest/1445/problem/COleg's favorite subjects are History and Math, and his favorite branch of mathematics is division.To improve his division skills, Oleg came up withttpairs of integerspipiandqiqiand for each pair decided...原创 2020-11-05 16:45:17 · 230 阅读 · 0 评论 -
D. Extreme Subtraction
链接:https://codeforces.ml/contest/1443/problem/DYou are given an arrayaaofnnpositive integers.You can use the following operation as many times as you like: select any integer1≤k≤n1≤k≤nand do one of two things:decrement by onekkof the first el...原创 2020-11-05 13:48:27 · 189 阅读 · 0 评论 -
C - Decreasing Heights
链接:https://vjudge.net/contest/399019#problem/CYou are playing one famous sandbox game with the three-dimensional world. The map of the world can be represented as a matrix of sizen×mn×m, where the height of the cell(i,j)(i,j)isai,jai,j.You are in t...原创 2020-10-04 18:39:37 · 216 阅读 · 0 评论 -
B - K-periodic Garland
链接:https://vjudge.net/contest/399019#problem/BYou are given a garland consisting ofnnlamps. States of the lamps are represented by the stringssof lengthnn. Theii-th character of the stringsisiequals '0' if theii-th lamp is turned off or '1' if t...原创 2020-10-04 18:38:28 · 234 阅读 · 0 评论 -
A - Maximum White Subtree
链接:https://vjudge.net/contest/399019#problem/AYou are given a tree consisting ofnnvertices. A tree is a connected undirected graph withn−1n−1edges. Each vertexvvof this tree has a color assigned to it (av=1av=1if the vertexvvis white and00if t...原创 2020-10-04 18:37:27 · 154 阅读 · 0 评论 -
B. Tokitsukaze, CSL and Stone Game
链接:https://codeforces.com/problemset/problem/1190/BTokitsukaze and CSL are playing a little game of stones.In the beginning, there arennpiles of stones, theii-th pile of which hasaiaistones. The two players take turns making moves. Tokitsukaze mov...原创 2020-10-02 15:35:28 · 226 阅读 · 0 评论 -
B. Stoned Game
链接:https://codeforces.com/problemset/problem/1396/BT is playing a game with his friend, HL.There arennpiles of stones, theii-th pile initially hasaiaistones.T and HL will take alternating turns, with T going first. In each turn, a player chooses...原创 2020-10-01 15:07:02 · 219 阅读 · 0 评论 -
D2. Sage‘s Birthday (hard version)
链接:https://codeforces.com/problemset/problem/1419/D2This is the hard version of the problem. The difference between the versions is that in the easy version all pricesaiaiare different. You can make hacks if and only if you solved both versions of the ..原创 2020-10-01 14:35:54 · 167 阅读 · 0 评论 -
A. Arena of Greed
链接:https://codeforces.com/problemset/problem/1425/ALately, Mr. Chanek frequently plays the gameArena of Greed. As the name implies, the game's goal is to find the greediest of them all, who will then be crowned king of Compfestnesia.The game is played.原创 2020-10-01 13:52:26 · 456 阅读 · 0 评论 -
D. Rescue Nibel!
链接:https://codeforces.ml/problemset/problem/1420/DOri and Sein have overcome many difficult challenges. They finally lit the Shrouded Lantern and found Gumon Seal, the key to the Forlorn Ruins. When they tried to open the door to the ruins... nothing hap原创 2020-09-30 13:42:30 · 142 阅读 · 0 评论 -
E. Rock, Paper, Scissors
链接:https://codeforces.com/problemset/problem/1426/EAlice and Bob have decided to play the game "Rock, Paper, Scissors".The game consists of several rounds, each round is independent of each other. In each round, both players show one of the following t原创 2020-09-30 12:46:43 · 491 阅读 · 0 评论 -
D. Decrease the Sum of Digits
链接:https://codeforces.ml/problemset/problem/1409/DYou are given a positive integernn. In one move, you can increasennby one (i.e. maken:=n+1n:=n+1). Your task is to find the minimum number of moves you need to perform in order to make the sum of digi...原创 2020-09-27 15:24:03 · 161 阅读 · 0 评论 -
C. Killjoy
链接:https://codeforces.ml/problemset/problem/1419/CA new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described byan integer(it can possibly be negative or very large).Killjoy's accou..原创 2020-09-27 14:55:46 · 159 阅读 · 0 评论 -
D. Two Divisors
链接:https://codeforces.com/contest/1366/problem/DYou are givennnintegersa1,a2,…,ana1,a2,…,an.For eachaiaifind itstwo divisorsd1>1d1>1andd2>1d2>1such thatgcd(d1+d2,ai)=1gcd(d1+d2,ai)=1(wheregcd(a,b)gcd(a,b)is the greatest common...原创 2020-07-10 19:33:26 · 279 阅读 · 0 评论 -
C. Palindromic Paths
链接:https://codeforces.com/contest/1366/problem/CYou are given a matrix withnnrows (numbered from11tonn) andmmcolumns (numbered from11tomm). A numberai,jai,jis written in the cell belonging to theii-th row and thejj-th column, each number is...原创 2020-07-10 19:31:59 · 248 阅读 · 0 评论 -
C. Rotation Matching
链接:https://codeforces.ml/contest/1365/problem/CAfter the mysterious disappearance of Ashish, his two favourite disciples Ishika and Hriday, were each left with one half of a secret message. These messages can each be represented by a permutation of size.原创 2020-07-09 19:45:39 · 157 阅读 · 0 评论 -
D. Solve The Maze
链接:https://codeforces.ml/contest/1365/problem/DVivek has encountered a problem. He has a maze that can be represented as ann×mn×mgrid. Each of the grid cells may represent the following:Empty— '.' Wall— '#' Good person — 'G' Bad person— 'B'Th...原创 2020-07-09 19:43:53 · 213 阅读 · 0 评论 -
E. Maximum Subsequence Value
链接:https://codeforces.ml/contest/1365/problem/ERidhiman challenged Ashish to find the maximum valued subsequence of an arrayaaof sizennconsisting of positive integers.The value of a non-empty subsequence ofkkelements ofaais defined as∑2i∑2iov...原创 2020-07-09 19:41:48 · 227 阅读 · 0 评论 -
C. Pluses and Minuses
链接:https://codeforces.ml/contest/1373/problem/CYou are given a stringssconsisting only of characters+and-. You perform some process with this string. This process can be described by the following pseudocode:res = 0for init = 0 to inf cur = ...原创 2020-07-07 12:35:00 · 194 阅读 · 0 评论 -
D. Zero Remainder Array
链接:https://codeforces.com/contest/1374/problem/DYou are given an arrayaaconsisting ofnnpositive integers.Initially, you have an integerx=0x=0. During one move, you can do one of the following two operations:Chooseexactly oneiifrom11tonnan...原创 2020-07-06 16:45:55 · 385 阅读 · 0 评论 -
D. Grid-00100
链接:https://codeforces.ml/contest/1371/problem/DA mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integersn,kn,k. Construct a gridAAwith sizen×nn×nconsisting of integers00and11. The very important co...原创 2020-07-06 09:20:44 · 240 阅读 · 0 评论 -
C. A Cookie for You
链接:https://codeforces.ml/contest/1371/problem/CAnna is a girl so brave that she is loved by everyone in the city and citizens love her cookies. She is planning to hold a party with cookies. Now she hasaavanilla cookies andbbchocolate cookies for the ...原创 2020-07-06 09:18:48 · 191 阅读 · 0 评论 -
E. Tree Shuffling
链接:https://codeforces.ml/contest/1363/problem/EAshish has a tree consisting ofnnnodes numbered11tonnrooted at node11. Theii-th node in the tree has a costaiai, and binary digitbibiis written in it. He wants to have binary digitciciwritten in...原创 2020-06-01 16:19:17 · 232 阅读 · 0 评论 -
C. Game On Leaves
链接https://codeforces.ml/contest/1363/problem/CAyush and Ashish play a game on an unrooted tree consisting ofnnnodes numbered11tonn. Players make the following move in turns:Select any leaf node in the tree and remove it together with any edge whic...原创 2020-06-01 16:18:09 · 234 阅读 · 0 评论