Kotlin Heroes: Episode 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
1297 Kotlin Heroes: Episode 3 FINISHED False 9000 154542311 Feb. 27, 2020, 1:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 117 ) F Movie Fan PROGRAMMING *special data structures greedy implementation sortings

B'Recently, Polycarp has been a fan of cinema novelties and is trying not to miss them! In the near future, n new movies will be released: the i -th of them will be airing from the day a_i and to the day b_i . This means that if Polycarp wants to watch the i -th movie in the cinema, he must do so in the period from a_i to b_i inclusive. If perhaps Polycarp will not have the opportunity to watch a movie in a cinema, he can then do it after day b_i by watching it using an online service. Of course, this is an undesirable outcome for Polycarp because the whole world will have time to discuss this movie on social networks! Polycarp can watch no more than m movies per day. Help Polycarp find a movie-watching schedule such that every movie will be watched in the cinema. If such a schedule does not exist, then Polycarp wants to watch movies so that: The first line contains an integer t ( 1 <= t <= 10^4 ) -- the number of test cases in the input. The following are descriptions of the t test cases. The first line of each test case contains two integers n and m ( 1 <= n <= 2 cdot 10^5 , 1 <= m <= 10^9 ) -- the number of movies and the maximum number of movies that Polycarp can view per day. In the next n lines, the movies themselves are described, one per line, by a pair of integers a_i , b_i ( 1 <= a_i <= b_i <= 10^9 ) -- the first and last airing days for the i -th movie. It is guaranteed that the sum of the values n for all test cases in the input does not exceed 2 cdot 10^5 . Print t answers to given test cases in the order in which they appear in the input: the i -th answer should consist of two lines. Print the integer d in the first line of each test case answer: In the second line of the answer to each test case, print n positive integers t_1, t_2, ... , t_n , where t_i is the number of th'...

Tutorials

Kotlin Heroes: Episode 3 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
71979097 xiaowuc1 F Feb. 27, 2020, 2:09 p.m. OK Kotlin TESTS 30 234 2867200
71981509 eatmore F Feb. 27, 2020, 2:36 p.m. OK Kotlin TESTS 30 265 5324800
71992148 Spheniscine F Feb. 27, 2020, 4:59 p.m. OK Kotlin TESTS 30 265 6246400
72015555 Spheniscine F Feb. 28, 2020, 5:33 a.m. OK Kotlin TESTS 30 280 6246400
71984857 Spheniscine F Feb. 27, 2020, 3:18 p.m. OK Kotlin TESTS 30 280 6246400
71991811 Spheniscine F Feb. 27, 2020, 4:53 p.m. OK Kotlin TESTS 30 280 6348800
71984889 wleung_bvg F Feb. 27, 2020, 3:18 p.m. OK Kotlin TESTS 30 343 31948800
71989854 kenkoooo F Feb. 27, 2020, 4:32 p.m. OK Kotlin TESTS 30 358 31027200
71985984 dalt F Feb. 27, 2020, 3:33 p.m. OK Kotlin TESTS 30 389 48537600
71980117 Benq F Feb. 27, 2020, 2:20 p.m. OK Kotlin TESTS 30 405 39116800

remove filters

Back to search problems