编程介的小学生 2019-04-13 23:54 采纳率: 20.5%
浏览 133

索引和搜索的一个快速算法的实现,怎么利用C语言的程序的设计来做的?

Problem Description
There are two kinds of people.

If person i is the first kind of people, it locates at position (pi, 0) initially, starts moving at time ti with a constant velocity of (0, v1), and then sees every person sits at the line segment (xi, yi), (xi + wi, yi), include the two points, where (xi, yi) is the position of person i at that time and wi is its vision.

If person i is the second kind of people, it locates at position (0, pi) initially, starts moving at time ti with a constant velocity of (v2, 0), and then sees every person sits at the line segment (xi, yi), (xi, yi + wi), include the two points, where (xi, yi) is the position of person i at that time and wi is its vision.

Now given the position of people, please calculate the number of distinct people every person has finally seen.

Input
There are multiply test cases.

The first line contains an integer T(T<=10), indicates the number of cases.

For each test case, the first line contains three integers n, v1, v2(1<=n,v1,v2<=10^5), indicating the total number of two kinds of people, the speed of the first kind, and the speed of the second kind.

Then comes N lines, the i-th line contains four integers ai, ti, pi, wi (1<=ai<=2, 1<=ti,pi,wi<=10^5), describing a person, where ai is the type, ti is time the person starts moving, pi is the location and wi is the vision.

It is granted that for the same kind of people, all ti, pi are different.

Output
For each case, you should output "Case #k:" first, where k indicates the case number and counts from 1.

Then output N lines, each lines is an integer, indicates the number of distinct people the i-th person finally recorded.

Sample Input
1
2 1 1
1 1 1 1
2 2 2 1

Sample Output
Case #1:
1
1

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥60 版本过低apk如何修改可以兼容新的安卓系统
    • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
    • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
    • ¥50 有数据,怎么用matlab求全要素生产率
    • ¥15 TI的insta-spin例程
    • ¥15 完成下列问题完成下列问题
    • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
    • ¥15 YoloV5 第三方库的版本对照问题
    • ¥15 请完成下列相关问题!
    • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?