Kotlin Heroes: Episode 7

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.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 276 ) E Chess Team Forming PROGRAMMING *special binary search data structures greedy

B"Polycarp is coaching a team for an upcoming game at the chess tournament. A complete team for the tournament should consist of n+1 members. There are n members in his team, the i -th member's skill value is a_i . Polycarp is yet to choose the final member for the team. The opposing team has n+1 members, the j -th member's skill value is b_j . Polycarp has m options for the final player of the team. The k -th of them has a skill value c_k . Before the game starts, Polycarp pairs up the members of his team with the members of the opposing team. Every member of both teams is in exactly one pair. The difficulty of a game for a certain player is the difference between his paired opponent's skill and his own skill. So if the i -th player of the Polycarp's team is paired up with the j -th member of the opposing team, then the difficulty is equal to b_j - a_i . The difficulty of the game for a team is the maximum difficulty of all its players. So, before the game starts, Polycarp wants to pair up the players in such a way that the difficulty of the game for his team is minimized. For each of the m options for the final player print the smallest difficulty of the game for the team Polycarp can achieve. The first line contains a single integer n ( 1 <= n <= 2 cdot 10^5 ) -- the number of members in the Polycarp's team. The second line contains n integers a_1, a_2, ... , a_n ( 1 <= a_i <= 10^9 ), where a_i is the skill value of the i -th player of the Polycarp's team. The third line contains n+1 integers b_1, b_2, ... , b_{n+1} ( 1 <= b_j <= 10^9 ), where b_j is the skill value of the j -th player of the opposing team. The fourth line contains a single integer m ( 1 <= m <= 2 cdot 10^5 ) -- the number of options for the final player. The fifth line contains m integers c_1, c_2, ... , c_m ( "...

Tutorials

Kotlin Heroes 7 — Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
120887000 Egor E June 29, 2021, 3:03 p.m. OK Kotlin TESTS 23 234 0
120891771 9646516 E June 29, 2021, 3:50 p.m. OK Kotlin TESTS 23 280 0
120887951 Spheniscine E June 29, 2021, 3:12 p.m. OK Kotlin TESTS 23 342 6963200
120920480 b2jena E June 30, 2021, 4:11 a.m. OK Kotlin TESTS 23 342 18022400
120896985 skittles1412 E June 29, 2021, 4:50 p.m. OK Kotlin TESTS 23 358 18124800
120888323 galen_colin E June 29, 2021, 3:15 p.m. OK Kotlin TESTS 23 373 17510400
120885759 Petr E June 29, 2021, 2:53 p.m. OK Kotlin TESTS 23 374 18022400
120892266 G.A.T.C E June 29, 2021, 3:55 p.m. OK Kotlin TESTS 23 374 18329600
120887194 eatmore E June 29, 2021, 3:05 p.m. OK Kotlin TESTS 23 389 18227200
120891153 crimsonred E June 29, 2021, 3:43 p.m. OK Kotlin TESTS 23 389 19456000

remove filters

Back to search problems