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 |
---|---|---|---|---|---|---|
1533 | Kotlin Heroes: Episode 7 | FINISHED | False | 9000 | 106845899 | June 29, 2021, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 771 ) | B | Nearest Point Function | PROGRAMMING | *special implementation |
B'Your friend has created a nearest point function. For a given array of integer points x (sorted in ascending order, without any duplicates) and a point y it can find the nearest point from x to the point y . In other words, it will find such a point x_i that |y - x_i| is the minimum possible, where |a| is the absolute value of a . For example, if x = [1, 2, 5, 7, 9, 11] , the answer for y=3 will be 2 , the answer for y=5 will be 5 and the answer for y=100 will be 11 . This function is a bit buggy, though. If there are several nearest points to the given one, the function crashes. For example, if x = [1, 2, 5, 7, 9, 11] (as above) and y=6 , the function will crash, since points 5 and 7 are both the nearest points for 6 . Your task is, for a given array of integer points x (sorted in ascending order, without any duplicates), determine if it is possible to cause the function to crash by choosing some integer point y . You have to answer t independent test cases. The first line of the input contains one integer t ( 1 <= t <= 10^4 ) -- the number of test cases. The first line of the test case contains one integer n ( 2 <= n <= 2 cdot 10^5 ) -- the number of points in the array x . The second line of the test case contains n integers x_1, x_2, ldots, x_n ( 1 <= x_i <= 10^9 ), where x_i is the i -th point in the array x . All points in the array x are distinct, and the array x is sorted in ascending order (in other words, x_1 < x_2 < ldots < x_n ). The sum of n over the test cases in the input does not exceed 2 cdot 10^5 ( sum n <= 2 cdot 10^5 ). For each test case, print YES if it is possible to find some integer point y that will crash the function and NO otherwise. In the first test case of the example, the function crashes'... |
Kotlin Heroes 7 — Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
120884391 | 9646516 | B | June 29, 2021, 2:42 p.m. | OK | Kotlin | TESTS | 14 | 109 | 0 | ||
120884670 | Egor | B | June 29, 2021, 2:44 p.m. | OK | Kotlin | TESTS | 14 | 139 | 0 | ||
120883854 | Spheniscine | B | June 29, 2021, 2:39 p.m. | OK | Kotlin | TESTS | 14 | 155 | 0 | ||
120920430 | b2jena | B | June 30, 2021, 4:10 a.m. | OK | Kotlin | TESTS | 14 | 155 | 3891200 | ||
120884741 | Jman | B | June 29, 2021, 2:45 p.m. | OK | Kotlin | TESTS | 14 | 155 | 3891200 | ||
120884713 | G.A.T.C | B | June 29, 2021, 2:45 p.m. | OK | Kotlin | TESTS | 14 | 155 | 3891200 | ||
120884569 | jainmilind | B | June 29, 2021, 2:44 p.m. | OK | Kotlin | TESTS | 14 | 155 | 3891200 | ||
120884144 | lightseba | B | June 29, 2021, 2:41 p.m. | OK | Kotlin | TESTS | 14 | 155 | 3891200 | ||
120892981 | OnlyForTshirt | B | June 29, 2021, 4:04 p.m. | OK | Kotlin | TESTS | 14 | 155 | 4096000 | ||
120884205 | nor | B | June 29, 2021, 2:41 p.m. | OK | Kotlin | TESTS | 14 | 155 | 4403200 |
Back to search problems