Codeforces Round 356 (Div. 2)
D
Bear and Tower of Cubes
Codeforces
未评级
原题
← CE →
翻译中…

Limak is a little polar bear. He plays by building towers from blocks. Every block is a cube with positive integer length of side. Limak has infinitely many blocks of each side length.

翻译中…

A block with side $*a*$ has volume $*a*^{3}$. A tower consisting of blocks with sides $*a*_{1}, *a*_{2}, ..., *a*_{*k*}$ has the total volume $*a*_{1}^{3} + *a*_{2}^{3} + ... + *a*_{*k*}^{3}$.

翻译中…

Limak is going to build a tower. First, he asks you to tell him a positive integer $*X*$ — the required total volume of the tower. Then, Limak adds new blocks greedily, one by one. Each time he adds the biggest block such that the total volume doesn't exceed $*X*$.

翻译中…

Limak asks you to choose $*X*$ not greater than $*m*$. Also, he wants to maximize the number of blocks in the tower at the end (however, he still behaves greedily). Secondarily, he wants to maximize $*X*$.

翻译中…

Can you help Limak? Find the maximum number of blocks his tower can have and the maximum $*X* ≤ *m*$ that results this number of blocks.

翻译中…

Input

翻译中…

The only line of the input contains one integer $*m*$ ($1 ≤ *m* ≤ 10^{15}$), meaning that Limak wants you to choose $*X*$ between $1$ and $*m*$, inclusive.

翻译中…

Output

翻译中…

Print two integers — the maximum number of blocks in the tower and the maximum required total volume $*X*$, resulting in the maximum number of blocks.

翻译中…

Note

翻译中…

In the first sample test, there will be $9$ blocks if you choose $*X* = 23$ or $*X* = 42$. Limak wants to maximize $*X*$ secondarily so you should choose $42$.

翻译中…

In more detail, after choosing $*X* = 42$ the process of building a tower is:

翻译中…
  • Limak takes a block with side $3$ because it's the biggest block with volume not greater than $42$. The remaining volume is $42 - 27 = 15$.
  • The second added block has side $2$, so the remaining volume is $15 - 8 = 7$.
  • Finally, Limak adds $7$ blocks with side $1$, one by one.
翻译中…

So, there are $9$ blocks in the tower. The total volume is is $3^{3} + 2^{3} + 7·1^{3} = 27 + 8 + 7 = 42$.

翻译中…

样例

Input #1
48
Output #1
9 42
InputCopy OutputCopy
Input #2
6
Output #2
6 6
InputCopy OutputCopy
题目信息
题号
680D
时间限制
2 s
内存限制
256 MB

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。