HBC243985B-SuffixArrayJetpack Problem题解

凸凸曼凸凸 算法基础篇 61 0
不断提升技能,才能在职场中立于不败之地!全网最全C++题库,助您成为编程领域的佼佼者。
Cuber QQ is playing on a modified version of this game. The map can be regarded as an infinite 2d-plane. We assume that the player's position is. begin{aligned} d_i&in{1,0,-1} & \ h_i&=h_{i-1}+sum_{j=1}^i d_j & end{aligned}. . Cuber QQ wants to know: the largest possible total value of coins he can get by playing only once. Output this number in its binary representation.

Jetpack Joyride is a 2011 side-scrolling endless runner action video game. The game uses a simple, one-touch system to control the jetpack; when the player presses anywhere on the touchscreen, the jetpack fires and Barry rises. When the player lets go, the jetpack turns off, and Barry falls. Because he is continually in motion, the player does not control his speed, simply his movement along the vertical axis.(Wikipedia) Cuber QQ is playing on a modified version of this game. The map can be regarded as an infinite 2d-plane. We assume that the player's position is (i,h_i) (i,h i ​ ) at the i i-th frame( ige 0 i≥0). For any valid sequence h h, h_0=0 h ​ =0 since the player starts at (0,0) (0,0). Also, there must exist a sequence d d, such that: begin{aligned} d_i&in{1,0,-1} &(ige 1) \ h_i&=h_{i-1}+sum_{j=1}^i d_j &(ige 1) end{aligned} d i ​ h i ​ ​ ∈{1,0,−1} =h i−1 ​ + j=1 ∑ i ​ d j ​ ​ (i≥1) (i≥1) ​ There are n n coins on the map, the j j-th coin is at (x_j,y_j) (x j ​ ,y j ​ ). By coincidence, x x is strictly increasing, and the j j-th coin has value 2^{n-j} 2 n−j . The player can get a coin, if and only if h_{x_j}=y_j h x j ​ ​ =y j ​ . Cuber QQ wants to know: the largest possible total value of coins he can get by playing only once. Output this number in its binary representation.

HBC243985B-SuffixArrayJetpack Problem题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
不断学习,不断挑战,才能在编程领域中脱颖而出!全网最全C++题库,助您成为编程高手!

标签: HBC243985B-SuffixArrayJetpack Problem题解