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"Marcin is a coach in his university. There are n students who want to attend a training camp. Marcin is a smart coach, so he wants to send only the students that can work calmly with each other. Let's focus on the students. They are indexed with integers from 1 to n . Each of them can be described with two integers a_i and b_i ; b_i is equal to the skill level of the i -th student (the higher, the better). Also, there are 60 known algorithms, which are numbered with integers from 0 to 59 . If the i -th student knows the j -th algorithm, then the j -th bit ( 2^j ) is set in the binary representation of a_i . Otherwise, this bit is not set. Student x thinks that he is better than student y if and only if x knows some algorithm which y doesn't know. Note that two students can think that they are better than each other. A group of students can work together calmly if no student in this group thinks that he is better than everyone else in this group. Marcin wants to send a group of at least two students which will work together calmly and will have the maximum possible sum of the skill levels. What is this sum? The first line contains one integer n ( 1 <= q n <= q 7000 ) -- the number of students interested in the camp. The second line contains n integers. The i -th of them is a_i ( 0 <= q a_i < 2^{60} ). The third line contains n integers. The i -th of them is b_i ( 1 <= q b_i <= q 10^9 ). Output one integer which denotes the maximum sum of b_i over the students in a group of students which can work together calmly. If no group of at least two students can work together calmly, print 0. In the first sample test, it's optimal to send the first, the second and the third student to the camp. It's also possible to send only the first and the third student, but they'd have a lower sum of b_i . In the"... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
64394188 |
Dream-chasing_Juvenile |
B |
Nov. 6, 2019, 3:52 p.m. |
OK |
GNU C++11 |
TESTS |
51 |
31 |
409600 |
|
1800 |
66805494 |
vjudge4 |
B |
Dec. 13, 2019, 8:49 p.m. |
OK |
GNU C++11 |
TESTS |
51 |
46 |
102400 |
|
1800 |
61204294 |
yumajj |
B |
Sept. 24, 2019, 9:02 a.m. |
OK |
GNU C++11 |
TESTS |
50 |
46 |
102400 |
|
1800 |
62404274 |
vjudge1 |
B |
Oct. 12, 2019, 8:27 a.m. |
OK |
GNU C++11 |
TESTS |
51 |
46 |
204800 |
|
1800 |
62399947 |
vjudge3 |
B |
Oct. 12, 2019, 7:01 a.m. |
OK |
GNU C++11 |
TESTS |
51 |
46 |
204800 |
|
1800 |
61984870 |
swan7 |
B |
Oct. 6, 2019, 1:12 p.m. |
OK |
GNU C++11 |
TESTS |
51 |
46 |
307200 |
|
1800 |
63279578 |
Pyqe |
B |
Oct. 24, 2019, 8:13 a.m. |
OK |
GNU C++11 |
TESTS |
51 |
46 |
409600 |
|
1800 |
61310710 |
yanghhh |
B |
Sept. 26, 2019, 9:08 a.m. |
OK |
GNU C++11 |
TESTS |
51 |
46 |
2355200 |
|
1800 |
62396808 |
vjudge3 |
B |
Oct. 12, 2019, 5:50 a.m. |
OK |
GNU C++11 |
TESTS |
51 |
61 |
716800 |
|
1800 |
61188276 |
AutumnKite |
B |
Sept. 24, 2019, 12:54 a.m. |
OK |
GNU C++11 |
TESTS |
50 |
77 |
0 |
|
1800 |
61061093 |
sava-cska |
B |
Sept. 22, 2019, 9:30 a.m. |
OK |
GNU C++14 |
TESTS |
50 |
31 |
102400 |
|
1800 |
61798218 |
Djovak |
B |
Oct. 3, 2019, 6 p.m. |
OK |
GNU C++14 |
TESTS |
51 |
31 |
2150400 |
|
1800 |
63556721 |
Mynesis |
B |
Oct. 27, 2019, 1:05 p.m. |
OK |
GNU C++14 |
TESTS |
51 |
46 |
307200 |
|
1800 |
61060773 |
cookiedoth |
B |
Sept. 22, 2019, 9:25 a.m. |
OK |
GNU C++14 |
TESTS |
50 |
46 |
512000 |
|
1800 |
62368026 |
Forever_Frivolous |
B |
Oct. 11, 2019, 2:27 p.m. |
OK |
GNU C++14 |
TESTS |
51 |
46 |
614400 |
|
1800 |
62106295 |
vjudge5 |
B |
Oct. 8, 2019, 10:52 a.m. |
OK |
GNU C++14 |
TESTS |
51 |
46 |
614400 |
|
1800 |
63247513 |
mostwanted7 |
B |
Oct. 23, 2019, 3:04 p.m. |
OK |
GNU C++14 |
TESTS |
51 |
46 |
819200 |
|
1800 |
66202194 |
KhaledFarhat |
B |
Dec. 2, 2019, 10:07 p.m. |
OK |
GNU C++14 |
TESTS |
51 |
46 |
921600 |
|
1800 |
66817191 |
one2345678 |
B |
Dec. 14, 2019, 6:13 a.m. |
OK |
GNU C++14 |
TESTS |
51 |
46 |
1843200 |
|
1800 |
64177369 |
sacred_games |
B |
Nov. 3, 2019, 9:48 p.m. |
OK |
GNU C++14 |
TESTS |
51 |
62 |
512000 |
|
1800 |
61060635 |
egor_bb |
B |
Sept. 22, 2019, 9:23 a.m. |
OK |
GNU C++17 |
TESTS |
50 |
46 |
102400 |
|
1800 |
65978530 |
Kais_Hasan |
B |
Nov. 29, 2019, 3:37 p.m. |
OK |
GNU C++17 |
TESTS |
51 |
46 |
204800 |
|
1800 |
62217513 |
grobert608 |
B |
Oct. 9, 2019, 4:25 p.m. |
OK |
GNU C++17 |
TESTS |
51 |
46 |
204800 |
|
1800 |
61583673 |
wanfeng_s |
B |
Oct. 1, 2019, 3:37 a.m. |
OK |
GNU C++17 |
TESTS |
51 |
46 |
204800 |
|
1800 |
61373436 |
GRT_2018 |
B |
Sept. 27, 2019, 3:38 p.m. |
OK |
GNU C++17 |
TESTS |
51 |
46 |
204800 |
|
1800 |
61060785 |
peltorator |
B |
Sept. 22, 2019, 9:25 a.m. |
OK |
GNU C++17 |
TESTS |
50 |
46 |
204800 |
|
1800 |
69621247 |
Sobachnyk |
B |
Jan. 27, 2020, 2:33 p.m. |
OK |
GNU C++17 |
TESTS |
51 |
46 |
307200 |
|
1800 |
69621201 |
mon.shy |
B |
Jan. 27, 2020, 2:32 p.m. |
OK |
GNU C++17 |
TESTS |
51 |
46 |
307200 |
|
1800 |
61514244 |
UminchuR |
B |
Sept. 29, 2019, 4:57 p.m. |
OK |
GNU C++17 |
TESTS |
51 |
46 |
409600 |
|
1800 |
65509199 |
couplefire |
B |
Nov. 22, 2019, 2:13 a.m. |
OK |
GNU C++17 |
TESTS |
51 |
46 |
512000 |
|
1800 |
64735570 |
yaoct |
B |
Nov. 12, 2019, 10:11 a.m. |
OK |
Java 8 |
TESTS |
51 |
202 |
0 |
|
1800 |
62845584 |
hsaaitlan__ |
B |
Oct. 18, 2019, 5:27 a.m. |
OK |
Java 8 |
TESTS |
51 |
248 |
0 |
|
1800 |
61060606 |
eatmore |
B |
Sept. 22, 2019, 9:23 a.m. |
OK |
Java 8 |
TESTS |
50 |
358 |
0 |
|
1800 |
61060312 |
qwerty787788 |
B |
Sept. 22, 2019, 9:18 a.m. |
OK |
Java 8 |
TESTS |
50 |
420 |
0 |
|
1800 |
61060301 |
VArtem |
B |
Sept. 22, 2019, 9:18 a.m. |
OK |
Java 8 |
TESTS |
50 |
421 |
0 |
|
1800 |
61990512 |
vaibhav28 |
B |
Oct. 6, 2019, 3:06 p.m. |
OK |
Java 8 |
TESTS |
51 |
514 |
0 |
|
1800 |
62403502 |
vjudge3 |
B |
Oct. 12, 2019, 8:12 a.m. |
OK |
MS C++ |
TESTS |
51 |
62 |
204800 |
|
1800 |
62403965 |
vjudge3 |
B |
Oct. 12, 2019, 8:21 a.m. |
OK |
MS C++ |
TESTS |
51 |
108 |
819200 |
|
1800 |
62405799 |
vjudge4 |
B |
Oct. 12, 2019, 8:55 a.m. |
OK |
MS C++ |
TESTS |
51 |
109 |
819200 |
|
1800 |
61669402 |
Anarxist |
B |
Oct. 1, 2019, 6:15 p.m. |
OK |
MS C++ |
TESTS |
51 |
124 |
102400 |
|
1800 |
62406457 |
vjudge1 |
B |
Oct. 12, 2019, 9:07 a.m. |
OK |
MS C++ |
TESTS |
51 |
342 |
614400 |
|
1800 |
61924640 |
Boryan07 |
B |
Oct. 5, 2019, 2:14 p.m. |
OK |
MS C++ 2017 |
TESTS |
51 |
217 |
102400 |
|
1800 |
62363850 |
CtrlAlt |
B |
Oct. 11, 2019, 1:16 p.m. |
OK |
MS C++ 2017 |
TESTS |
51 |
358 |
102400 |
|
1800 |
65796355 |
jdbermeol |
B |
Nov. 27, 2019, 5:01 a.m. |
OK |
PyPy 3 |
TESTS |
51 |
421 |
6553600 |
|
1800 |
62164477 |
mridullgarg |
B |
Oct. 8, 2019, 7:33 p.m. |
OK |
PyPy 3 |
TESTS |
51 |
732 |
5324800 |
|
1800 |
68435018 |
Firepaw |
B |
Jan. 9, 2020, 8:37 a.m. |
OK |
PyPy 3 |
TESTS |
51 |
1279 |
10035200 |
|
1800 |
62642049 |
polarstern |
B |
Oct. 15, 2019, 6:26 p.m. |
OK |
Python 3 |
TESTS |
51 |
1606 |
1536000 |
|
1800 |
61583953 |
vaibhav014 |
B |
Oct. 1, 2019, 3:47 a.m. |
OK |
Python 3 |
TESTS |
51 |
2588 |
1536000 |
|
1800 |
remove filters
Back to search problems