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ủ

#1301 · Warp

MÔ TẢ BÀI TOÁN

Justin is lost in a maze and needs to find a way out. The maze consists of n rooms numbered from 1 to n. Each room is encoded with a natural number from 0 to 2^{30}-1.

Justin is currently in room 1. In this room, there are instructions that Justin can move from room a to room b if and only if:

  • $a < b$
  • Let the room codes of a and b be x and y, respectively. Then, there exists a natural number k such that \lfloor \frac{x}{2^k}, \frac{y}{2^k} \rfloor are all odd.

At the same time, the number of ways Justin moves from room a to room b is equal to the number of natural numbers k that satisfy the above requirement. Justin knows that he needs to reach room n to escape the maze.

How many ways are there for Justin to move from room 1 to room n? Two ways are considered different if Justin passes through a room in one way but not in the other, or if Justin uses two different ways to move between two rooms. Additionally, because the answer can be very large, only give the answer modulo 10^9+7.

Dữ liệu vào

  • The first line contains an integer n, the number of rooms in the maze (1 \leq n \leq 10^5).
  • The second line contains n positive integers not greater than 10^9, where the i^{th} number is the code of the i^{th} room.

Dữ liệu ra

Print a single integer which is the number of ways for Justin to move from room 1 to room n modulo 10^9+7

Ràng buộc

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

# Tài khoản Kết suất Lúc nộp
1
21 ms 276 KB
1871 Bytes
26/03/2023
21:49
2
42 ms 256 KB
852 Bytes
25/03/2023
19:49
3
45 ms 304 KB
1873 Bytes
23/12/2025
15:28
4
74 ms 1476 KB
1319 Bytes
17/10/2025
14:35
5
Lê Duy Hải @2280600799
78 ms 1468 KB
2471 Bytes
17/01/2025
16:15
6
Lê Duy Hải @2280600799
79 ms 1476 KB
2172 Bytes
17/01/2025
16:16
7
Lê Duy Hải @2280600799
82 ms 1472 KB
2384 Bytes
17/01/2025
16:15
8
T
155 ms 256 KB
680 Bytes
25/03/2023
20:34
9
173 ms 1296 KB
652 Bytes
23/03/2023
15:45

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