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 |
1571
|
Kotlin Heroes: Episode 8 |
FINISHED |
False |
9900 |
103649063 |
Oct. 7, 2021, 2:35 p.m. |
Problems
B"Polycarp plans to undergo a full physical examination at his local clinic. There are n doctors, numbered from 1 to n . The i -th doctor takes patients from minute L_i to minute R_i , so Polycarp can visit him at any minute in this range. It takes each doctor exactly one minute to examine Polycarp's health. Polycarp wants to arrive at the clinic at some minute x and visit all n doctors in some order without waiting or visiting any doctor several times. More formally, he chooses an integer x and a permutation p_1, p_2, ... , p_n (a sequence of n integers from 1 to n such that each integer appears exactly once), then proceeds to visit: The p_i -th doctor should be able to take patients at minute x+i-1 , so the following should hold: L[p_i] <= x + i - 1 <= R[p_i] . Determine if it's possible for Polycarp to choose such a minute x and a permutation p that he'll be able to visit all n doctors in without waiting or visiting any doctor several times. If there are multiple answers, print any of them. The first line contains a single integer t ( 1 <= t <= 100 ) -- the number of testcases. Then the descriptions of t testcases follow. The first line of the testcase contains a single integer n ( 1 <= n <= 10^5 ) -- the number of doctors. The second line of the testcase contains n integers L_1, L_2, ... L_n ( 1 <= L_i <= 10^9 ). The third line of the testcase contains n integers R_1, R_2, ... R_n ( L_i <= R_i <= 10^9 ). The sum of n over all testcases doesn't exceed 10^5 . For each testcase print an answer. If there exists such a minute x and a permutation p that Polycarp is able to visit all n doctors without waiting or visiting any doctor several times, then print x in the first line and a permutation p in the second line. If there are multiple "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
131090638 |
eatmore |
I |
Oct. 7, 2021, 5:07 p.m. |
OK |
Kotlin 1.4 |
TESTS |
30 |
264 |
24985600 |
|
|
131093135 |
jtnydv25 |
I |
Oct. 7, 2021, 5:42 p.m. |
OK |
Kotlin 1.4 |
TESTS |
30 |
561 |
33177600 |
|
|
131093424 |
SpyCheese |
I |
Oct. 7, 2021, 5:46 p.m. |
OK |
Kotlin 1.4 |
TESTS |
30 |
561 |
36864000 |
|
|
131095370 |
jtnydv25 |
I |
Oct. 7, 2021, 6:17 p.m. |
OK |
Kotlin 1.4 |
TESTS |
30 |
577 |
34304000 |
|
|
131089641 |
Heltion |
I |
Oct. 7, 2021, 4:55 p.m. |
OK |
Kotlin 1.4 |
TESTS |
30 |
873 |
31027200 |
|
|
131115935 |
Vercingetorix |
I |
Oct. 8, 2021, 4:14 a.m. |
OK |
Kotlin 1.5 |
TESTS |
31 |
623 |
37785600 |
|
|
131100344 |
darnley |
I |
Oct. 7, 2021, 7:44 p.m. |
OK |
Kotlin 1.5 |
TESTS |
30 |
716 |
55091200 |
|
|
131118671 |
Vercingetorix |
I |
Oct. 8, 2021, 5:16 a.m. |
OK |
Kotlin 1.5 |
TESTS |
31 |
717 |
39936000 |
|
|
131109167 |
darnley |
I |
Oct. 8, 2021, 12:40 a.m. |
OK |
Kotlin 1.5 |
TESTS |
31 |
779 |
53760000 |
|
|
131109881 |
Alan233 |
I |
Oct. 8, 2021, 1:26 a.m. |
OK |
Kotlin 1.5 |
TESTS |
31 |
919 |
37990400 |
|
|
131091688 |
Maksim1744 |
I |
Oct. 7, 2021, 5:21 p.m. |
OK |
Kotlin 1.5 |
TESTS |
30 |
998 |
38809600 |
|
|
remove filters
Back to search problems