CF整理题
2019年10月份开始的cf题目
楚仙子
我只是想学算法
展开
-
Nastya and Scoreboard
Denis, after buying flowers and sweets (you will learn about this story in the next task), went to a date with Nastya to ask her to become a couple. Now, they are sitting in the cafe and finally… Deni...原创 2020-04-26 13:18:15 · 350 阅读 · 0 评论 -
Weights Distributing
Weights DistributingYou are given an undirected unweighted graph consisting of n vertices and m edges (which represents the map of Bertown) and the array of prices p of length m. It is guaranteed tha...原创 2020-04-24 01:12:27 · 201 阅读 · 0 评论 -
Constant Palindrome Sum
Constant Palindrome SumYou are given an array a consisting of n integers (it is guaranteed that n is even, i.e. divisible by 2). All aia_{i}ai does not exceed some integer k.Your task is to replace...原创 2020-04-23 23:36:50 · 219 阅读 · 0 评论 -
Instant Noodles
Instant NoodlesWu got hungry after an intense training session, and came to a nearby store to buy his favourite instant noodles. After Wu paid for his purchase, the cashier gave him an interesting ta...原创 2020-03-17 12:36:44 · 623 阅读 · 0 评论 -
Present
PresentCatherine received an array of integers as a gift for March 8. Eventually she grew bored with it, and she started calculated various useless characteristics for it. She succeeded to do it for ...原创 2020-03-16 22:38:46 · 256 阅读 · 0 评论 -
Unusual Competitions
Unusual CompetitionsA 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 “...原创 2020-03-16 14:44:44 · 210 阅读 · 0 评论 -
Count Subrectangles
Count SubrectanglesYou are given an array a of length nnn and array bbb of length mmm both consisting of only integers 0 and 1. Consider a matrix ccc of size n×mn×mn×m formed by following rule: ci,j=...原创 2020-03-16 14:26:18 · 251 阅读 · 2 评论 -
Array Shrinking
Array ShrinkingYou are given an array a1,a2,…,ana1,a2,…,ana1,a2,…,an. You can perform the following operation any number of times:Choose a pair of two neighboring equal elements ai=ai+1ai=ai+1ai=ai...原创 2020-03-13 17:07:59 · 328 阅读 · 0 评论 -
Count the Arrays
Count the ArraysYour task is to calculate the number of arrays such that:each array contains n elements;each element is an integer from 1 to m;for each array, there is exactly one pair of equal e...原创 2020-03-13 16:51:46 · 292 阅读 · 0 评论 -
Adding Powers
Adding PowersSuppose you are performing the following algorithm. There is an array v1v1v1,v2v2v2,…,vnvnvn filled with zeroes at start. The following operation is applied to the array several times — ...原创 2020-03-13 16:12:12 · 153 阅读 · 0 评论 -
Jamie and Binary Sequence (changed after round)
题目Jamie is preparing a Codeforces round. He has got an idea for a problem, but does not know how to solve it. Help him write a solution to the following problem:Find k integers such that the sum of ...原创 2020-01-15 20:31:17 · 162 阅读 · 0 评论 -
Jamie and Interesting Graph
题目Jamie has recently found undirected weighted graphs with the following properties very interesting:The graph is connected and contains exactly n vertices and m edges.All edge weights are integer...原创 2020-01-15 17:32:54 · 159 阅读 · 0 评论 -
Two Arrays
题目You are given two integers n and m. Calculate the number of pairs of arrays (a,b) such that:the length of both arrays is equal to m;each element of each array is an integer between 1 and n (incl...原创 2020-01-15 11:28:43 · 529 阅读 · 0 评论 -
Permute Digits
题目You are given two positive integer numbers a and b. Permute (change order) of the digits of a to construct maximal number not exceeding b. No number in input and/or output can start with the digit ...原创 2020-01-14 16:57:49 · 182 阅读 · 0 评论 -
Fishes
题目While Grisha was celebrating New Year with Ded Moroz, Misha gifted Sasha a small rectangular pond of size n × m, divided into cells of size 1 × 1, inhabited by tiny evil fishes (no more than one fi...原创 2020-01-14 15:11:06 · 289 阅读 · 0 评论 -
Dr. Evil Underscores
题目Today, as a friendship gift, Bakry gave Badawy n integers a1,a2,…,an and challenged him to choose an integer X such that the value max1≤i≤n(ai⊕X) is minimum possible, where ⊕ denotes the bitwise XO...原创 2020-01-13 21:41:42 · 355 阅读 · 0 评论 -
Fadi and LCM
题目Today, Osama gave Fadi an integer X, and Fadi was wondering about the minimum possible value of max(a,b) such that LCM(a,b) equals X. Both a and b should be positive integers.LCM(a,b) is the small...原创 2020-01-13 21:30:12 · 489 阅读 · 0 评论 -
Just Eat It!
题目Today, Yasser and Adel are at the shop buying cupcakes. There are n cupcake types, arranged from 1 to n on the shelf, and there are infinitely many of each type. The tastiness of a cupcake of type ...原创 2020-01-13 21:07:53 · 1014 阅读 · 0 评论 -
Managing Difficulties
Managing DifficultiesEvery day a new programming problem is published on Codehorses. Thus, n problems will be published in the following n days: the difficulty of the ii-th problem is ai.原创 2019-11-13 01:45:52 · 1390 阅读 · 1 评论 -
Absolute Game
Absolute Game原创 2019-11-12 23:27:32 · 995 阅读 · 0 评论 -
Salary Changing
Salary ChangingYou are the head of a large enterprise. n people work at you, and n is odd (i. e. n is not divisible by 2).You have to distribute salaries to your employees. Initially, you have ss do...原创 2019-11-10 17:17:24 · 126 阅读 · 0 评论 -
0-1 MST
0-1 MSTUjan has a lot of useless stuff in his drawers, a considerable part of which are his math notebooks: it is time to sort them out. This time he found an old dusty graph theory notebook with a d...原创 2019-11-09 16:45:34 · 510 阅读 · 0 评论 -
Shichikuji and Power Grid
Shichikuji and Power GridShichikuji is the new resident deity of the South Black Snail Temple. Her first job is as follows:There are n new cities located in Prefecture X. Cities are numbered from 1 ...原创 2019-11-03 17:05:29 · 268 阅读 · 0 评论 -
By Elevator or Stairs?
By Elevator or Stairs?You are planning to buy an apartment in a n-floor building. The floors are numbered from 1 to n from the bottom to the top. At first for each floor you want to know the minimum ...原创 2019-10-27 20:39:55 · 310 阅读 · 0 评论 -
Good Numbers
Good NumbersThe only difference between easy and hard versions is the maximum value of n.You are given a positive integer number n. You really love good numbers so you want to find the smallest good...原创 2019-10-27 19:42:44 · 290 阅读 · 1 评论 -
Books Exchange
Books ExchangeThe only difference between easy and hard versions is constraints.There are n kids, each of them is reading a unique book. At the end of any day, the i-th kid will give his book to the...原创 2019-10-26 11:55:53 · 143 阅读 · 0 评论 -
Alice and the List of Presents
Alice and the List of PresentsAlice got many presents these days. So she decided to pack them into boxes and send them to her friends.There are n kinds of presents. Presents of one kind are identica...原创 2019-10-21 21:44:21 · 366 阅读 · 0 评论 -
Ivan the Fool and the Probability Theory
Ivan the Fool and the Probability TheoryRecently Ivan the Fool decided to become smarter and study the probability theory. He thinks that he understands the subject fairly well, and so he began to be...原创 2019-10-21 20:28:54 · 1086 阅读 · 6 评论 -
The Football Season
The Football SeasonThe football season has just ended in Berland. According to the rules of Berland football, each match is played between two teams. The result of each match is either a draw, or a v...原创 2019-10-15 13:12:22 · 383 阅读 · 0 评论 -
Marcin and Training Camp
Marcin and Training CampMarcin is a coach in his university. There are nn students who want to attend a training camp. Marcin is a smart coach, so he wants to send only the students that can work cal...原创 2019-10-13 23:32:44 · 196 阅读 · 0 评论 -
Anadi and Domino
Anadi and DominoAnadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every aa and bb such that 1≤a≤b≤6, there is exactly one domino with aa dots on one half ...原创 2019-10-13 23:14:21 · 214 阅读 · 0 评论 -
Complete Tripartite
Complete TripartiteYou have a simple undirected graph consisting of n vertices and m edges. The graph doesn’t contain self-loops, there is at most one edge between a pair of vertices. The given graph...原创 2019-10-11 23:45:24 · 227 阅读 · 0 评论 -
Primes and Multiplication
Primes and Multiplication原创 2019-10-11 23:28:11 · 117 阅读 · 0 评论 -
AB-string
AB-stringThe string t1t2…tk is good if each letter of this string belongs to at least one palindrome of length greater than 1.A palindrome is a string that reads the same backward as forward. For ex...原创 2019-10-10 17:40:15 · 361 阅读 · 0 评论 -
Pipes
PipesYou are given a system of pipes. It consists of two rows, each row consists of n pipes. The top left pipe has the coordinates (1,1) and the bottom right — (2,n).There are six types of pipes: tw...原创 2019-10-02 16:35:10 · 1183 阅读 · 0 评论 -
Remove the Substring
题目The only difference between easy and hard versions is the length of the string.You are given a string s and a string t, both consisting only of lowercase Latin letters. It is guaranteed that t can...原创 2019-08-15 16:28:57 · 217 阅读 · 0 评论 -
Common Divisors
题目You are given an array aa consisting of n integers.Your task is to say the number of such positive integers x such that x divides each number from the array. In other words, you have to find the n...原创 2019-08-15 16:11:39 · 416 阅读 · 0 评论 -
You Are Given a Decimal String...(CodeForces - 1202B)
题目Suppose you have a special x-y-counter. This counter can store some value as a decimal number; at first, the counter has value 0.The counter performs the following algorithm: it prints its lowest ...原创 2019-08-11 10:12:53 · 790 阅读 · 0 评论