Codeforces Round 923 (Div. 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
1927 Codeforces Round 923 (Div. 3) FINISHED False 8100 24592499 Feb. 6, 2024, 2:45 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 28182 ) C Choose the Different Ones! PROGRAMMING brute force greedy math

B'Given an array a of n integers, an array b of m integers, and an even number k . Your task is to determine whether it is possible to choose exactly frac{k}{2} elements from both arrays in such a way that among the chosen elements, every integer from 1 to k is included. For example: Note that you are not required to find a way to choose the elements -- your program should only check whether it is possible to choose the elements in the required way. The first line of the input contains a single integer t ( 1 <= t <= 10^4 ) -- the number of test cases. The descriptions of the test cases follow. The first line of each test case contains three integers n , m , and k ( 1 <= n, m <= 2 cdot10^5 , 2 <= k <= 2 cdot min(n, m) , k is even) -- the length of array a , the length of array b , and the number of elements to be chosen, respectively. The second line of each test case contains n integers a_1, a_2, ... , a_n ( 1 <= a_i <= 10^6 ) -- the elements of array a . The third line of each test case contains m integers b_1, b_2, ... , b_m ( 1 <= b_j <= 10^6 ) -- the elements of array b . It is guaranteed that the sum of values n and m over all test cases in a test does not exceed 4 cdot 10^5 . Output t lines, each of which is the answer to the corresponding test case. As the answer, output "YES" if it is possible to choose frac{k}{2} numbers from each array in such a way that among the chosen elements, every integer from 1 to k is included. Otherwise, output "NO". You can output each letter in any case (lowercase or uppercase). For example, the strings "yEs", "yes", "Yes", and "YES" will be accepted as a positive answer. In the first test case of the example, it is possible to choose elements equal to 2 , 3 , and 6 from array a and elements equ'...

Tutorials

125597

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
245255143 abdoalmowafy C Feb. 6, 2024, 7:37 p.m. OK C# 10 TESTS 10 139 45363200
245264266 wollohq C Feb. 6, 2024, 9:20 p.m. OK C# 10 TESTS 16 155 62464000
245282393 bluemegane C Feb. 7, 2024, 3:19 a.m. OK C# 8 TESTS 16 280 42086400

remove filters

Back to search problems