#P3769. [CH弱省胡策R2] TATT

    ID: 2713 远端评测题 2000ms 512MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>线段树平衡树分治排序K-D Tree

[CH弱省胡策R2] TATT

Description

Four-dimensional space is truly wonderful. Now there are nn points in four-dimensional space. Find a longest path such that, along the path, each coordinate in every dimension is monotonically non-decreasing.

Note that the starting point of the path can be chosen arbitrarily, and the path is independent of the input order (the order along the path does not need to be increasing in the input).

The length of a path is the number of points visited, and any point can be visited at most once.

Input Format

The first line contains an integer nn. The next nn lines each contain four integers ai,bi,ci,dia_i,b_i,c_i,d_i, representing a 4D coordinate.

Output Format

Output one integer in a single line, the length of a longest path.

4
2 3 33 2333
2 3 33 2333
2 3 33 2333
2 3 33 2333

4

Hint

Let mi=max(ai,bi,ci,di),m=max(mi)m_i=\max(|a_i|,|b_i|,|c_i|,|d_i|),m=\max(m_i). | Test point index | nn\le | mm\le | Special note | | :----------: | :----------: | :----------: | :----------: | | 11 | 20002000 | 10910^9 | | | 22 | 5×1045\times 10^4 | 88 | | | 343\sim 4 | 5×1045\times 10^4 | 10510^5 | The 3rd and 4th coordinates of all points are the same | | 565\sim 6 | 5×1045\times 10^4 | 10510^5 | The 4th coordinate of all points is the same | | 787\sim 8 | 5×1045\times 10^4 | 100100 | | | 9109\sim 10 | 5×1045\times 10^4 | 10910^9 | |

Translated by ChatGPT 5