京セラプログラミングコンテスト2021(AtCoder Beginner Contest 200)
E
Patisserie ABC 2
AtCoder
⌀ 1955
原题
← DF →
翻译中…

Problem Statement

翻译中…

Takahashi, a pastry chef at ABC Confiserie, has decided to make cakes to celebrate AtCoder Beginner Contest 200.

翻译中…

A cake made by Takahashi has three parameters: beauty, taste, and popularity, each of which is represented by an integer between $1$ and $N$ (inclusive).

翻译中…

He has made a cake of beauty $i$, taste $j$, and popularity $k$ for every triple $(i,j,k)\ (1 \le i,j,k \le N)$. Then, he has arranged these $N^3$ cakes in a row, as follows:

翻译中…
  • The cakes are in ascending order of sum of beauty, taste, and popularity from left to right.
  • For two cakes with the same sum of beauty, taste, and popularity, the cake with the smaller beauty is to the left.
  • For two cakes with the same sum and the same beauty, the cake with the smaller taste is to the left.
翻译中…

Find the beauty, taste, and popularity of the $K$-th cake from the left.

翻译中…

Constraints

翻译中…
  • All values in input are integers.
  • $1 \le N \le 10^6$
  • $1 \le K \le N^3$
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N K

翻译中…

Output

翻译中…

Print three integers representing the cake's beauty, taste, popularity, in this order, with spaces in between.

翻译中…

样例

Input #1
2 5
Output #1
1 2 2
The cakes are in the following order: $(1,1,1),(1,1,2),(1,2,1),(2,1,1),(1,2,2),(2,1,2),(2,2,1),(2,2,2)$. Here, each triple of integers represents the beauty, taste, and popularity of a cake.
Input #2
1000000 1000000000000000000
Output #2
1000000 1000000 1000000
The values in input may be large.
Input #3
9 47
Output #3
3 1 4
题目信息
题号
abc200_e
时间限制
2 s
内存限制
1024 MB

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