luogu#P7860. [COCI 2015/2016 #2] ARTUR

    ID: 7146 远端评测题 1000ms 128MiB 尝试: 0 已通过: 0 难度: 6 上传者: 标签>2015Special Judge拓扑排序COCI(克罗地亚)

[COCI 2015/2016 #2] ARTUR

Problem Description

There are nn sticks placed on a tabletop. Find an order to move the sticks toward the edge of the table along the xx axis, such that the sticks do not collide (all sticks move toward the table edge at the same speed).

Input Format

The first line contains an integer NN, the total number of sticks.

The next NN lines each contain four integers x1i,y1i,x2i,y2ix1_i,y1_i,x2_i,y2_i, representing the coordinates of the two endpoints of a stick.

Output Format

Output one line with nn integers, representing a valid order to move the sticks.

4
1 3 2 2
1 1 3 2
2 4 7 3
3 3 5 3

2 4 1 3
4
0 0 1 1
1 2 0 3
2 2 3 3
4 0 3 1

4 3 1 2
3
4 6 5 5
2 1 15 1
3 2 8 7

2 3 1

Hint

Sample 1 Explanation

As shown in the figure, another valid moving order is 2 1 4 3.

Constraints

For 40%40\% of the testdata, 1N101\le N\le 10.

For 60%60\% of the testdata, 1N3001\le N\le 300.

For 100%100\% of the testdata, 1N50001\le N\le 5000, 0x1,y1,x2,y21040\le x1,y1,x2,y2\le 10^4.

Notes

The scoring of this problem follows the original problem, with a full score of 100.

This problem is translated from T3 ARTUR of COCI 2015-2016 CONTEST #2.

Translated by ChatGPT 5