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 149012699 Feb. 27, 2020, 1:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 414 ) B Cartoons PROGRAMMING *special implementation sortings

B"Tanya likes cartoons. She knows that n new cartoons will be released in his favorite cinema: the i -th of them will be airing from the day a_i to the day b_i ( 1 <= a_i <= b_i <= 10^9 ). The cinema has a special offer: there is a huge discount every day when only one cartoon is airing. Tanya doesn't care which cartoon she will watch but she'd like to save some money. That's why she asks you to find any day x when only one cartoon will be airing. Formally: find x such that there is exactly one i ( 1 <= i <= n ) with a_i <= x <= b_i . If there are several possible answers, print any of them. If there is no such day, print -1. The first line contains single integer t ( 1 <= t <= 1000 ) -- the number of test cases. The following are descriptions of the t test cases. The first line of each test case contains a single integer n ( 1 <= n <= 2000 ) -- the number of cartoons. In the next n lines, the cartoons 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 cartoon. It is guaranteed that the sum of the values n for all test cases in the input does not exceed 2000 . Print t answers to given test cases in the order in which they appear in the input: the i -th answer is such x , that only one cartoon will be airing on day x or -1 if there are no such days. In the third test case: at day 1 and 2 , first and third cartoons will be airing, and days 3 and 4 , second and third cartoons will be airing. So, there is no day when only one cartoon will be airing. In the fourth test case, 11 is also a possible answer. "...

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
72025080 Ebrahim_Emon B Feb. 28, 2020, 9:07 a.m. OK Kotlin TESTS 12 109 0
71980059 falanga B Feb. 27, 2020, 2:19 p.m. OK Kotlin TESTS 12 109 0
71979373 pajenegod B Feb. 27, 2020, 2:12 p.m. OK Kotlin TESTS 12 109 0
71977020 icebound B Feb. 27, 2020, 1:49 p.m. OK Kotlin TESTS 12 109 0
71976979 eatmore B Feb. 27, 2020, 1:49 p.m. OK Kotlin TESTS 12 109 0
71986480 anony9906 B Feb. 27, 2020, 3:40 p.m. OK Kotlin TESTS 12 124 0
71986294 zucker42 B Feb. 27, 2020, 3:37 p.m. OK Kotlin TESTS 12 124 0
71983934 kelvinc1024 B Feb. 27, 2020, 3:06 p.m. OK Kotlin TESTS 12 124 0
71979812 Mur B Feb. 27, 2020, 2:17 p.m. OK Kotlin TESTS 12 124 0
71976968 artsin666 B Feb. 27, 2020, 1:49 p.m. OK Kotlin TESTS 12 124 0

remove filters

Back to search problems