Problem 2262 Best Friend Forever

TimeLimit:3000MS  MemoryLimit:32MB
64-bit integer IO format:%I64d
未提交 | 登录后收藏
Problem Description

Perhaps some of you guys may curious about the relationship between Fat Brother and Maze, why they always came up together? Well, in fact, they are childhood sweethearts; they studied in the same primary school, same middle school and same high school. Also, they always studied in the same class, what a coincidence!

But there is no magic in this world, the whole things are just because, L, a clever student who is in the same age as Fat Brother. He always helped teachers dividing students into the classes. Every time he did that, he would divide Fat Brother and Maze into the same class just because he knows that Fat Brother loves Maze.

But dividing students into classes is not an easy task, assume that there are 1000 students in a grade and they need to be divided into 20 classes. To make a good dividing, the follow conditions must be fulfilled.

1. For any two classes, the number of the students of them must be equal.

2. The number of the male students and the female students in each class must be equal.

3. For any two classes, the difference between the average score of the Literature could not be large than 0.12.

4. For any two classes, the difference between the average score of the Mathematics could not be large than 0.12.

5. For any two classes, the difference between the average score of the English could not be large than 0.12.

6. Fat Brother and Maze must be in the same class.

So now you know that L is Fat Brother’s best friend forever.

Input

There is just one input with 1000 lines in the data case. Each line consists of 4 integers which indicate a student’s information. The first three integers represent this student’s Literature, Mathematics and English score (0 <= score <= 100) respectively. The forth integer represents this student’s gender, 0 for the male and 1 for the female. The first line of the data is Fat Brother’s information and the second line is Maze’s information. The number of the male students and the number of the female students are equal in the input data.

Output

Output 1000 integers in one line, the ith integer represents the class that the ith student should be on. If your output fulfills all the requirements, you would pass the test data. It is guaranteed that there exists at least one correct answer.

SampleInput
60 90 1 0
100 100 100 1
45 66 34 1
22 44 95 1
34 9 84 0
94 83 9 1
29 85 9 0
48 96 81 0
SampleOutput
1 1 2 4 3 3 2 4
Submit
题目统计信息详细
总AC数0
通过人数0
尝试人数0
总提交量0
AC率0.00%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: