Codeforces Round 908 (Div. 1)

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
1893 Codeforces Round 908 (Div. 1) FINISHED False 7200 37812263 Nov. 7, 2023, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 945 ) D Colorful Constructive PROGRAMMING constructive algorithms greedy math

B"You have n colored cubes, the i -th cube has color a_i . You need to distribute all the cubes on shelves. There are a total of m shelves, the i -th shelf can hold s_i cubes. Also, s_1 + s_2 + ldots + s_m = n . Suppose on a shelf of size k there are cubes of colors c_1, c_2, ldots, c_k , in this order. Then we define the colorfulness of the shelf as the minimum distance between two different cubes of the same color on the shelf. If all the cubes on the shelf have different colors, then the colorfulness is considered to be equal to the size of the shelf, that is, the number k . More formally, the colorfulness of c_1, c_2, ldots, c_k is defined as follows: For each shelf, you are given the minimum required colorfulness, that is, you are given numbers d_1, d_2, ldots, d_m , which mean that shelf i must have a colorfulness geq d_i for all i . Distribute the available cubes among the shelves to ensure the required colorfulness, or report that it is impossible. Each test contains multiple test cases. The first line contains a single integer t (1 <= q t <= q 10^4) -- the number of test cases. The description of the test cases follows. The first line of each test case contains two integers n, m (1 <= q m <= q n <= q 2 cdot 10^5) -- the number of cubes and the number of shelves to distribute them to. The second line of each test case contains n integers a_1, a_2, ldots, a_n (1 <= q a_i <= q n) -- the colors of the cubes. The third line of each test case contains m integers s_1, s_2, ldots, s_m (1 <= q s_i <= q n) -- the sizes of the shelves. It's guaranteed, that s_1 + ldots + s_m = n . The fourth line of each test case contains m integers d_1, d_2, ldots, d_m (1 <= q d_i <= q s_i) -- the minimum required colorfulness of the shelves. It is guaranteed that the sum of n over all t"...

Tutorials

Codeforces Round 908 (Div. 1, Div, 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
231773015 Gassa D Nov. 7, 2023, 3:30 p.m. OK D TESTS 55 343 24678400
231817462 hos.lyric D Nov. 7, 2023, 4:31 p.m. OK D TESTS 55 498 38297600
231837444 rainboy D Nov. 7, 2023, 6:24 p.m. OK GNU C11 TESTS 55 1638 10342400
231816408 Leasier D Nov. 7, 2023, 4:28 p.m. OK GNU C++14 TESTS 55 156 9523200
231829049 rfpermen D Nov. 7, 2023, 5:19 p.m. OK GNU C++14 TESTS 55 171 12697600
231832301 vjudge1 D Nov. 7, 2023, 5:41 p.m. OK GNU C++14 TESTS 55 171 12697600
231816494 Mapakaka D Nov. 7, 2023, 4:28 p.m. OK GNU C++14 TESTS 55 186 19148800
231815531 StarSilk D Nov. 7, 2023, 4:26 p.m. OK GNU C++14 TESTS 55 187 14848000
231797709 Flamire D Nov. 7, 2023, 4:18 p.m. OK GNU C++14 TESTS 55 202 16691200
231818396 Iratis D Nov. 7, 2023, 4:33 p.m. OK GNU C++14 TESTS 55 218 11059200
231825949 chenyanbo D Nov. 7, 2023, 5:02 p.m. OK GNU C++14 TESTS 55 249 14131200
231869380 awu D Nov. 8, 2023, 12:38 a.m. OK GNU C++14 TESTS 55 654 8294400
231884601 Hanghang007 D Nov. 8, 2023, 4:56 a.m. OK GNU C++14 TESTS 55 1013 48742400
231860163 Ant_Man D Nov. 7, 2023, 9 p.m. OK GNU C++17 TESTS 55 156 7680000
231870143 AkaiLemon D Nov. 8, 2023, 12:55 a.m. OK GNU C++17 TESTS 55 171 8704000
231778377 huzhaoyang D Nov. 7, 2023, 3:43 p.m. OK GNU C++17 TESTS 55 186 7884800
231854665 Intellegent D Nov. 7, 2023, 8:08 p.m. OK GNU C++17 TESTS 55 186 8294400
231786810 Lalic D Nov. 7, 2023, 4:05 p.m. OK GNU C++17 TESTS 55 187 8192000
231828646 serotonin D Nov. 7, 2023, 5:17 p.m. OK GNU C++17 TESTS 55 187 8704000
231815907 Weobe D Nov. 7, 2023, 4:27 p.m. OK GNU C++17 TESTS 55 187 11673600
231868008 Yellow_Submarine01 D Nov. 8, 2023, 12:04 a.m. OK GNU C++17 TESTS 55 202 4812800
231788992 fengchang D Nov. 7, 2023, 4:11 p.m. OK GNU C++17 TESTS 55 202 7065600
231784824 HOLlC D Nov. 7, 2023, 4 p.m. OK GNU C++17 TESTS 55 202 9523200
231781033 ITworker_Z D Nov. 7, 2023, 3:50 p.m. OK GNU C++17 (64) TESTS 55 62 30412800
231877217 DJ2006 D Nov. 8, 2023, 3:06 a.m. OK GNU C++17 (64) TESTS 55 109 10547200
231825693 HuaJun D Nov. 7, 2023, 5:02 p.m. OK GNU C++17 (64) TESTS 55 109 11264000
231826345 locsey D Nov. 7, 2023, 5:04 p.m. OK GNU C++17 (64) TESTS 55 124 10956800
231829395 tarjen D Nov. 7, 2023, 5:21 p.m. OK GNU C++17 (64) TESTS 55 124 11059200
231829023 tarjen D Nov. 7, 2023, 5:19 p.m. OK GNU C++17 (64) TESTS 55 124 11059200
231780513 MiracleMaMa D Nov. 7, 2023, 3:49 p.m. OK GNU C++17 (64) TESTS 55 124 11776000
231785460 ttttan D Nov. 7, 2023, 4:02 p.m. OK GNU C++17 (64) TESTS 55 124 12492800
231827418 Irmuun.Ch D Nov. 7, 2023, 5:10 p.m. OK GNU C++17 (64) TESTS 55 124 13619200
231830778 Egor.Lifar D Nov. 7, 2023, 5:29 p.m. OK GNU C++17 (64) TESTS 55 124 24371200
231770732 5sb D Nov. 7, 2023, 3:25 p.m. OK GNU C++20 (64) TESTS 55 46 11673600
231789448 Sulfox D Nov. 7, 2023, 4:13 p.m. OK GNU C++20 (64) TESTS 55 77 16281600
231788887 Dawnq D Nov. 7, 2023, 4:11 p.m. OK GNU C++20 (64) TESTS 55 92 19046400
231782090 magnus.hegdahl D Nov. 7, 2023, 3:53 p.m. OK GNU C++20 (64) TESTS 55 93 8704000
231827238 Kude D Nov. 7, 2023, 5:09 p.m. OK GNU C++20 (64) TESTS 55 93 9523200
231828013 sysulby D Nov. 7, 2023, 5:13 p.m. OK GNU C++20 (64) TESTS 55 93 9523200
231785348 Astolfoo D Nov. 7, 2023, 4:01 p.m. OK GNU C++20 (64) TESTS 55 93 10342400
231888642 angry_face D Nov. 8, 2023, 5:50 a.m. OK GNU C++20 (64) TESTS 55 93 10342400
231787796 apoorv_me D Nov. 7, 2023, 4:08 p.m. OK GNU C++20 (64) TESTS 55 93 11059200
231825964 ganeid D Nov. 7, 2023, 5:02 p.m. OK GNU C++20 (64) TESTS 55 93 11264000
231838046 zouyu9631 D Nov. 7, 2023, 6:30 p.m. OK PyPy 3-64 TESTS 55 529 43417600
231838363 zouyu9631 D Nov. 7, 2023, 6:33 p.m. OK PyPy 3-64 TESTS 55 654 42905600
231838352 alexwice D Nov. 7, 2023, 6:33 p.m. OK PyPy 3-64 TESTS 55 1013 62259200
231833687 shade34 D Nov. 7, 2023, 5:52 p.m. OK PyPy 3-64 TESTS 55 1388 83865600
231883669 chinerist D Nov. 8, 2023, 4:42 a.m. OK PyPy 3-64 TESTS 55 1496 104857600
231774128 Egor D Nov. 7, 2023, 3:33 p.m. OK Rust 2021 TESTS 55 78 20480000

remove filters

Back to search problems