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.
Problems
B'Alice and Bob received n candies from their parents. Each candy weighs either 1 gram or 2 grams. Now they want to divide all candies among themselves fairly so that the total weight of Alice 's candies is equal to the total weight of Bob 's candies. Check if they can do that. Note that candies are not allowed to be cut in half. The first line contains one integer t ( 1 <= t <= 10^4 ) -- the number of test cases. Then t test cases follow. The first line of each test case contains an integer n ( 1 <= n <= 100 ) -- the number of candies that Alice and Bob received. The next line contains n integers a_1, a_2, ldots, a_n -- the weights of the candies. The weight of each candy is either 1 or 2 . It is guaranteed that the sum of n over all test cases does not exceed 10^5 . For each test case, output on a separate line: You can output "YES" and "NO" in any case (for example, the strings yEs, yes, Yes and YES will be recognized as positive). In the first test case, Alice and Bob can each take one candy, then both will have a total weight of 1 . In the second test case, any division will be unfair. In the third test case, both Alice and Bob can take two candies, one of weight 1 and one of weight 2 . In the fourth test case, it is impossible to divide three identical candies between two people. In the fifth test case, any division will also be unfair. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
103305908 |
shake_fayaz123 |
B |
Jan. 4, 2021, 4:50 p.m. |
OK |
Clang++17 Diagnostics |
TESTS |
6 |
296 |
0 |
|
|
103332417 |
VN.Kiet |
B |
Jan. 4, 2021, 11:55 p.m. |
OK |
FPC |
TESTS |
6 |
46 |
0 |
|
|
103336212 |
20050901 |
B |
Jan. 5, 2021, 2:16 a.m. |
OK |
GNU C++11 |
TESTS |
6 |
15 |
0 |
|
|
103340912 |
Rainer1116 |
B |
Jan. 5, 2021, 4:20 a.m. |
OK |
GNU C++11 |
TESTS |
6 |
15 |
0 |
|
|
103336376 |
ce_amtic |
B |
Jan. 5, 2021, 2:21 a.m. |
OK |
GNU C++11 |
TESTS |
6 |
15 |
0 |
|
|
103334701 |
Vilespine_Slayer |
B |
Jan. 5, 2021, 1:22 a.m. |
OK |
GNU C++11 |
TESTS |
6 |
30 |
819200 |
|
|
103335572 |
icysky |
B |
Jan. 5, 2021, 1:53 a.m. |
OK |
GNU C++11 |
TESTS |
6 |
31 |
0 |
|
|
103336421 |
joecai |
B |
Jan. 5, 2021, 2:22 a.m. |
OK |
GNU C++11 |
TESTS |
6 |
31 |
0 |
|
|
103336281 |
Wyijin |
B |
Jan. 5, 2021, 2:18 a.m. |
OK |
GNU C++11 |
TESTS |
6 |
31 |
0 |
|
|
103345544 |
shyyhsac |
B |
Jan. 5, 2021, 5:58 a.m. |
OK |
GNU C++11 |
TESTS |
6 |
31 |
0 |
|
|
103340603 |
newbie2015 |
B |
Jan. 5, 2021, 4:13 a.m. |
OK |
GNU C++11 |
TESTS |
6 |
31 |
0 |
|
|
103340470 |
topcoder815 |
B |
Jan. 5, 2021, 4:11 a.m. |
OK |
GNU C++11 |
TESTS |
6 |
31 |
0 |
|
|
103337487 |
JudeBirch |
B |
Jan. 5, 2021, 2:56 a.m. |
OK |
.NET Core C# |
TESTS |
6 |
109 |
2969600 |
|
|
103313350 |
Nenad1337 |
B |
Jan. 4, 2021, 5:46 p.m. |
OK |
.NET Core C# |
TESTS |
6 |
109 |
3072000 |
|
|
remove filters
Back to search problems