编程介的小学生 2019-05-25 08:33 采纳率: 20.5%
浏览 111

坐标区间的搜索算法设计的问题,怎么利用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条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 安装svn网络有问题怎么办
    • ¥15 Python爬取指定微博话题下的内容,保存为txt
    • ¥15 vue2登录调用后端接口如何实现
    • ¥65 永磁型步进电机PID算法
    • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
    • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
    • ¥15 如何处理复杂数据表格的除法运算
    • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
    • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
    • ¥15 latex怎么处理论文引理引用参考文献