随笔分类 - online judge Codeforces
摘要:C. Messy You are fed up with your messy room, so you decided to clean it up. Your room is a bracket sequence s=s1s2…sn of length n. Each character of
阅读全文
摘要:B. Box Permutation p is a sequence of integers p=[p1,p2,…,pn], consisting of n distinct (unique) positive integers between 1 and n, inclusive. For exa
阅读全文
摘要:A. Math Problem Your math teacher gave you the following problem: There are n segments on the x axis, [l1;r1],[l2;r2],…,[ln;rn]. The segment [l;r] inc
阅读全文
摘要:E. The Contest A team of three programmers is going to play a contest. The contest consists of 𝑛 problems, numbered from 1 to 𝑛. Each problem is pri
阅读全文
摘要:D. Yet Another Monster Killing Problem You play a computer game. In this game, you lead a party of 𝑚 heroes, and you have to clear a dungeon with 𝑛
阅读全文
摘要:C. Dominated Subarray Let's call an array 𝑡 dominated by value 𝑣 in the next situation. At first, array 𝑡 should have at least 2 elements. Now, let
阅读全文
摘要:B. Magic Stick Recently Petya walked in the forest and found a magic stick. Since Petya really likes numbers, the first thing he learned was spells fo
阅读全文
摘要:A. Two Rival Students There are 𝑛 students in the row. And there are two rivalling students among them. The first one is in position 𝑎, the second i
阅读全文
摘要:D. Catowice City In the Catowice city next weekend the cat contest will be held. However, the jury members and the contestants haven't been selected y
阅读全文
摘要:C. Queue in the Train There are 𝑛 seats in the train's car and there is exactly one passenger occupying every seat. The seats are numbered from 1 to
阅读全文
摘要:D2. The World Is Just a Programming Task (Hard Version) This is a harder version of the problem. In this version, 𝑛≤300000. Vasya is an experienced d
阅读全文
摘要:B. Grow The Tree Gardener Alexey teaches competitive programming to high school students. To congratulate Alexey on the Teacher's Day, the students ha
阅读全文
摘要:A. Integer Points DLS and JLS are bored with a Math lesson. In order to entertain themselves, DLS took a sheet of paper and drew 𝑛 distinct lines, gi
阅读全文
摘要:A. Ivan the Fool and the Probability Theory Recently Ivan the Fool decided to become smarter and study the probability theory. He thinks that he under
阅读全文
摘要:E. Connected Components? You are given an undirected graph consisting of n vertices and edges. Instead of giving you the edges that exist in the graph
阅读全文
摘要:C. Sum Balance Ujan has a lot of numbers in his boxes. He likes order and balance, so he decided to reorder the numbers. There are 𝑘 boxes numbered f
阅读全文
摘要:D. 0 1 MST Ujan 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
阅读全文
摘要:C. Tile Painting Ujan has been lazy lately, but now has decided to bring his yard to good shape. First, he decided to paint the path from his house to
阅读全文
摘要:B2. Character Swap (Hard Version) This problem is different from the easy version. In this version Ujan makes at most 2𝑛 swaps. In addition, 𝑘≤1000,
阅读全文
摘要:B1. Character Swap (Easy Version) This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this
阅读全文