CF44G.Shooting Gallery
省选/NOI-
通过率:0%
时间限制:5.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Berland amusement park shooting gallery is rightly acknowledged as one of the best in the world. Every day the country's best shooters master their skills there and the many visitors compete in clay pigeon shooting to win decent prizes. And the head of the park has recently decided to make an online version of the shooting gallery. During the elaboration process it turned out that the program that imitates the process of shooting effectively, is needed. To formulate the requirements to the program, the shooting gallery was formally described. A 3D Cartesian system of coordinates was introduced, where the X axis ran across the gallery floor along the line, along which the shooters are located, the Y axis ran vertically along the gallery wall and the positive direction of the Z axis matched the shooting direction. Let's call the XOY plane a shooting plane and let's assume that all the bullets are out of the muzzles at the points of this area and fly parallel to the Z axis. Every clay pigeon can be represented as a rectangle whose sides are parallel to X and Y axes, and it has a positive z-coordinate. The distance between a clay pigeon and the shooting plane is always different for every target. The bullet hits the target if it goes through the inner area or border of the rectangle corresponding to it. When the bullet hits the target, the target falls down vertically into the crawl-space of the shooting gallery and cannot be shot at any more. The targets are tough enough, that's why a bullet can not pierce a target all the way through and if a bullet hits a target it can't fly on. In input the simulator program is given the arrangement of all the targets and also of all the shots in the order of their appearance. The program should determine which target was hit by which shot. If you haven't guessed it yet, you are the one who is to write such a program.
贝尔兰游乐园射击场被公认为世界上最好的射击场之一。每天,全国最优秀的射手都在此精进技艺,众多游客则通过飞碟射击比赛争夺丰厚奖品。近日,该射击场负责人决定开发一款在线版射击场。在设计过程中,人们发现需要一个能有效模拟射击过程的程序。为明确该程序的功能需求,人们首先对射击场进行了形式化建模:引入一个三维笛卡尔坐标系,其中 X 轴沿射击者所站位置所在的直线水平延伸(与射击场地面重合),Y 轴沿射击场墙面垂直向上,Z 轴正方向则与射击方向一致。我们将 XOY 平面称为“射击平面”,并假定所有子弹均从该平面上的某点射出,且飞行方向始终平行于 Z 轴。每个飞碟可表示为一个边分别平行于 X 轴和 Y 轴的矩形,其 z 坐标恒为正值。每个飞碟到射击平面的距离互不相同。当子弹穿过对应矩形的内部区域或边界时,即视为命中目标。一旦被击中,该飞碟便立即沿竖直方向坠入射击场下方的检修通道,此后无法再被击中。飞碟材质极为坚固,因此子弹无法穿透飞碟;一旦命中,子弹即停止运动,不再继续飞行。程序输入包括所有飞碟的初始位置信息,以及所有射击动作(按其发生顺序排列)的信息。程序需判定每次射击命中了哪一个飞碟。如果你尚未意识到,那么——你,就是负责编写该程序的人。
输入格式
The first line contains an integer n (1 ≤ n ≤ 105) — the number of targets. Each of the subsequent n lines contains the description of a target. The target is described by five integers x__l, x__r, y__l, y__r, z, that determine it's location in space (0 ≤ x__l < x__r ≤ 107, 0 ≤ y__l < y__r ≤ 107, 0 < z ≤ 107). The next line contains an integer m (1 ≤ m ≤ 105), determining the number of shots. Then in m lines shots are described. Every shot is determined by the coordinates of a bullet on the shooting plane (x, y) (0 ≤ x, y ≤ 107, the coordinates of bullets are integers). The shots are given in the order of their firing. The intervals between shots are large enough, and a target falls very quickly, that's why assume that a falling target can not be an obstruction for all the shots following the one that hit it.
第一行包含一个整数 n(1≤n≤105)——目标的数量。接下来的 n 行每行描述一个目标。每个目标由五个整数 xl,xr,yl,yr,z 描述,用于确定其在空间中的位置(0≤xl<xr≤107,0≤yl<yr≤107,0<z≤107)。
下一行包含一个整数 m(1≤m≤105),表示射击次数。随后的 m 行依次描述每次射击。每次射击由子弹在射击平面上的坐标 (x,y) 给出(0≤x,y≤107,子弹坐标均为整数)。射击按发射顺序给出。两次射击之间的间隔足够长,且目标倒下非常迅速,因此可假设:被某次射击击中的目标在倒下后,不会对后续所有射击构成遮挡。
输出格式
For every shot in the single line print the number of the target which the shot has hit, or 0, if the bullet did not hit any target. The targets are numbered starting from 1 in the order in which they were given in the input data.
对于单行中的每一次射击,输出该次射击所击中的目标编号;若子弹未击中任何目标,则输出 0。目标按输入数据中给出的顺序从 1 开始编号。
输入输出样例
输入#1
2 1 4 1 4 1 2 5 2 6 2 4 0 0 3 3 4 5 3 5
输出#1
0 1 2 0
输入解题思路,AI测评打分。不知道怎么写?