Kotlin Heroes 5: ICPC Round

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
1431 Kotlin Heroes 5: ICPC Round FINISHED False 9000 126631499 Nov. 12, 2020, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 224 ) E Chess Match PROGRAMMING *special

B"The final of Berland Chess Team Championship is going to be held soon. Two teams consisting of n chess players each will compete for first place in the tournament. The skill of the i -th player in the first team is a_i , and the skill of the i -th player in the second team is b_i . The match will be held as follows: each player of the first team will play a game against one player from the second team in such a way that every player has exactly one opponent. Formally, if the player i from the first team opposes the player p_i from the second team, then [p_1, p_2, ... , p_n] is a permutation (a sequence where each integer from 1 to n appears exactly once). Whenever two players of almost equal skill play a game, it will likely result in a tie. Chess fans don't like ties, so the organizers of the match should distribute the players in such a way that ties are unlikely. Let the unfairness of the match be the following value: min limits_{i = 1}^{n} |a_i - b_{p_i}| . Your task is to assign each player from the first team an opponent from the second team so that the unfairness is maximum possible (the greater it is, the smaller the probability of ties is, that's why you should maximize it). The first line contains one integer t ( 1 <= t <= 3000 ) -- the number of test cases. Each test case consists of three lines. The first line contains one integer n ( 1 <= n <= 3000 ) -- the number of players in each team. The second line contains n integers a_1, a_2, ... , a_n ( 1 <= a_1 <= a_2 <= ... <= a_n <= 10^6 ) -- the skills of players of the first team. The third line contains n integers b_1, b_2, ... , b_n ( 1 <= b_1 <= b_2 <= ... <= b_n <= 10^6 ) -- the skills of players of the second team. It is guaranteed that the sum of n over all test cases does not exceed 3000 . For each test case, output the answer as follows: Pri"...

Tutorials

84563

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
98219646 icebound E Nov. 12, 2020, 4:36 p.m. OK Kotlin TESTS 7 124 0
98211856 eatmore E Nov. 12, 2020, 3:07 p.m. OK Kotlin TESTS 7 124 0
98226138 i_am_legend1 E Nov. 12, 2020, 6:13 p.m. OK Kotlin TESTS 7 139 0
98221885 AryssonFigueiredo E Nov. 12, 2020, 5:03 p.m. OK Kotlin TESTS 7 139 0
98221382 Fischer E Nov. 12, 2020, 4:58 p.m. OK Kotlin TESTS 7 139 0
98216857 timf1089 E Nov. 12, 2020, 3:59 p.m. OK Kotlin TESTS 7 140 0
98213645 artsin666 E Nov. 12, 2020, 3:25 p.m. OK Kotlin TESTS 7 140 0
98225637 june_waves E Nov. 12, 2020, 6:04 p.m. OK Kotlin TESTS 7 155 0
98218261 6aren E Nov. 12, 2020, 4:18 p.m. OK Kotlin TESTS 7 155 0
98212525 Fortin E Nov. 12, 2020, 3:13 p.m. OK Kotlin TESTS 7 155 0

remove filters

Back to search problems