Codeforces Round 847 (Div. 3)

Solutions are presented as using the least memory and the fastest execution time. It also takes the top 10 most recent solutions from each language. If you want to limit to a specific index, click the "Solved" button and go to that problem.

ContestId
Name
Phase
Frozen
Duration (Seconds)
Relative Time
Start Time
1790 Codeforces Round 847 (Div. 3) FINISHED False 8100 62349863 Jan. 27, 2023, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 21607 ) D Matryoshkas PROGRAMMING data structures greedy sortings

B'Matryoshka is a wooden toy in the form of a painted doll, inside which you can put a similar doll of a smaller size. A set of nesting dolls contains one or more nesting dolls, their sizes are consecutive positive integers. Thus, a set of nesting dolls is described by two numbers: s -- the size of a smallest nesting doll in a set and m -- the number of dolls in a set. In other words, the set contains sizes of s, s + 1, ... , s + m - 1 for some integer s and m ( s,m > 0 ). You had one or more sets of nesting dolls. Recently, you found that someone mixed all your sets in one and recorded a sequence of doll sizes -- integers a_1, a_2, ... , a_n . You do not remember how many sets you had, so you want to find the minimum number of sets that you could initially have. For example, if a given sequence is a=[2, 2, 3, 4, 3, 1] . Initially, there could be 2 sets: According to a given sequence of sizes of nesting dolls a_1, a_2, ... , a_n , determine the minimum number of nesting dolls that can make this sequence. Each set is completely used, so all its nesting dolls are used. Each element of a given sequence must correspond to exactly one doll from some set. The first line of input data contains a single integer t ( 1 <= t <= 10^4 ) -- the number of test cases. The description of the test cases follows. The first line of each test case contains one integer n ( 1 <= n <= 2 cdot 10^5 ) -- the total number of matryoshkas that were in all sets. The second line of each test case contains n integers a_1, a_2, ... , a_n ( 1 <= a_i <= 10^9 ) -- the sizes of the matryoshkas. It is guaranteed that the sum of values of n over all test cases does not exceed 2 cdot10^5 . For each test case, print one integer k -- the minimum possible number of matryoshkas sets. The first test case is described in the problem statement. In the second test case, all ma'...

Tutorials

111948

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
190920191 codertop1 D Jan. 28, 2023, 3:35 a.m. OK Clang++17 Diagnostics TESTS 25 1091 10547200
190919236 xiaomadada D Jan. 28, 2023, 3:14 a.m. OK Clang++20 Diagnostics TESTS 25 1669 19968000
190919809 zhoujunl D Jan. 28, 2023, 3:27 a.m. OK Clang++20 Diagnostics TESTS 25 1840 10956800
190919563 zhoujunl D Jan. 28, 2023, 3:21 a.m. OK Clang++20 Diagnostics TESTS 25 1871 10956800
190889127 jiayuan8 D Jan. 27, 2023, 6:07 p.m. OK Clang++20 Diagnostics TESTS 25 1903 9523200
190916671 luogu_bot4 D Jan. 28, 2023, 2:13 a.m. OK GNU C++14 TESTS 25 62 2457600
190920502 Narayan__nl D Jan. 28, 2023, 3:41 a.m. OK GNU C++14 TESTS 25 77 819200
190900202 Kalsoe D Jan. 27, 2023, 8:06 p.m. OK GNU C++14 TESTS 25 78 819200
190924548 sakd23 D Jan. 28, 2023, 4:46 a.m. OK GNU C++14 TESTS 25 78 1638400
190904651 rohbiv D Jan. 27, 2023, 9:11 p.m. OK GNU C++14 TESTS 25 78 1638400
190901811 SergiiGolovko D Jan. 27, 2023, 8:29 p.m. OK GNU C++14 TESTS 25 78 1638400
190920372 natalia7992 D Jan. 28, 2023, 3:39 a.m. OK GNU C++14 TESTS 25 78 2457600
190917193 17879963468 D Jan. 28, 2023, 2:26 a.m. OK GNU C++14 TESTS 25 78 2457600
190916155 bluetian1st D Jan. 28, 2023, 2 a.m. OK GNU C++14 TESTS 25 78 2457600
190915508 bluetian1st D Jan. 28, 2023, 1:44 a.m. OK GNU C++14 TESTS 25 78 2457600

remove filters

Back to search problems