Không hỗ trợ Mobile

Chế độ luyện tập yêu cầu môi trường màn hình lớn để làm bài và chống gian lận hiệu quả. Vui lòng truy cập bằng máy tính (Desktop/Laptop) để tiếp tục thao tác.

Quay lại trang chủ

#1252 · GROUP

The XYZ class has N students numbered from 1 to N. Each student is represented by two positive integers a_i and b_i, where b_i represents the skill level of the i student. There are 60 subjects taught in the class. Student i is good at subject j if the j^{th} bit of the binary representation of a_i is 1, otherwise it is 0.

Student i feels superior to student j if and only if there is at least one subject that i is good at but j is not. In other words, when a_i and a_j are represented in binary form, there exists a position k where the k^{th} bit of a_i is 1 and the k^{th} bit of a_j is 0. Two students may both feel superior to another student.

The homeroom teacher wants to select a group of students to participate in a competition. The group is formed if there are at least 2 members and no member in the group feels superior to all other members. The teacher wants to select the group with the highest total skill level of the students. Help the teacher find the maximum total skill level. If it is not possible to form a group, output 0.

Dữ liệu vào

  • The first line contains an integer N, (1 \leq N \leq 5000).
  • The next line contains N integers. The ith integer represents $a_i (0 \leq a_i < 2^{60})$.
  • The last line contains N integers. The i_{th} integer represents b_i (1 \leq b_i \leq 10^5).

Ràng buộc

  • Subtask 1 (50% of tests): 1 \leq N \leq 1000
  • Subtask 2 (50% of tests): There are no additional constraints.

BẢNG TỔNG QUAN KẾT QUẢ

# Tài khoản Kết suất Lúc nộp
1
6 ms 656 KB
1626 Bytes
25/02/2023
19:34
2
6 ms 780 KB
6051 Bytes
25/02/2023
21:26
3
7 ms 644 KB
1626 Bytes
26/02/2023
11:45
4
Đ
7 ms 812 KB
998 Bytes
25/02/2023
20:58
5
8 ms 572 KB
997 Bytes
04/09/2025
08:18
6
B
Trần Gia Bảo @2380600172
9 ms 384 KB
2565 Bytes
13/01/2026
22:14
7
14 ms 676 KB
1626 Bytes
23/12/2025
15:28
8
Lê Duy Hải @2280600799
20 ms 656 KB
1357 Bytes
11/07/2024
11:00
9
Lê Duy Hải @2280600799
20 ms 660 KB
868 Bytes
11/07/2024
13:51
10
Lê Duy Hải @2280600799
21 ms 656 KB
1357 Bytes
11/07/2024
11:01
11
Lê Duy Hải @2280600799
21 ms 660 KB
1357 Bytes
11/07/2024
11:01
12
Lê Duy Hải @2280600799
22 ms 664 KB
1357 Bytes
11/07/2024
11:01
13
Lê Duy Hải @2280600799
23 ms 660 KB
1357 Bytes
11/07/2024
11:01
14
Lê Duy Hải @2280600799
24 ms 660 KB
1357 Bytes
11/07/2024
11:01
15
Lê Duy Hải @2280600799
25 ms 656 KB
1357 Bytes
11/07/2024
11:01
16
40 ms 408 KB
991 Bytes
23/02/2023
16:11
17
48 ms 640 KB
2264 Bytes
21/07/2025
08:59
18
49 ms 336 KB
832 Bytes
25/09/2023
00:36
19
T
66 ms 396 KB
849 Bytes
25/02/2023
19:35

LỊCH SỬ CÁ NHÂN

Vui lòng đăng nhập để xem lịch sử làm bài của bạn.

THẢO LUẬN BÀI TOÁN

Chưa có thảo luận nào cho bài này.

Viết code