HDU 4946 area of mushroom

Source: Internet
Author: User
Click "area of mushroom ". Time Limit: 2000/1000 MS (Java/others) memory limit: 65536/65536 K (Java/Others)
Total submission (s): 1257 accepted submission (s): 307


Problem descriptionteacher Mai has a kingdom with the infinite area.

He has n students guarding the kingdom.

The I-th Student stands at the position (XI, Yi), and his walking speed is vi.

If a point can be reached by a student, and the time this student walking to this point is Strictly lessThan other students, this point is in the charge of this student.

For every student, teacher Mai wants to know if the area in the charge of him is infinite.
Inputthere are multiple test cases, terminated by a line "0 ".

For each test case, the first line contains one integer N (1 <= n <= 500 ).

In following n lines, each line contains three integers Xi, Yi, VI (0 <=| Xi |, | Yi |, VI <= 10 ^ 4 ).
Outputfor each case, output "case # K: s", where k is the case number counting from 1, and S is a string consisting of n character. if the area in the charge of the I-th Student isn't infinite, the I-th character is "0", else it's "1 ".
Sample Input
30 0 31 1 22 2 10
 
Sample output
Case #1: 100
 
Source2014 multi-university training contest 8
Give you the coordinates and velocity of N points. If a point can reach infinity distance and takes the least time, 1 is output at this point; otherwise, 0 is output. Each vertex expands outward in the form of a garden, so only the highest speed can reach infinity, but not all vertices with the highest speed can reach infinity. Make a convex hull of all vertices with the highest speed. The vertices in the convex hull certainly cannot reach infinity. Only the vertices on the convex hull meet the conditions.
// Define ms292k # include <stdio. h> # include <math. h ># include <algorithm> using namespace STD; struct point {int X, Y, K, ID, VIS, flag; point (INT x = 0, int y = 0 ): x (x), y (y) {}// constructor}; typedef point vector; point operator-(point a, point B) {return point (. x-B.x,. y-B.y);} int cross (point a, point B) {return. x * B. y-A.y * B. x;} int CMP1 (point a, point B) {if (. k = B. k) {if (. X = B. x) return. Y <B. y; return. x <B. x;} return. k> B. k;} int cmp2 (point a, point B) {return. ID <B. ID;} int convexhull (point * P, int N, point * Ch) // returns the convex hull {int m = 0; For (INT I = 0; I <N; I ++) {While (M> 1 & cross (CH [M-1]-ch [m-2], p [I]-ch [m-2]) <= 0) M --; ch [M ++] = P [I];} int K = m; For (INT I = n-2; I> = 0; I --) {While (M> K & cross (CH [s-1]-ch [m-2], p [I]-ch [m-2]) <= 0) m --; ch [M ++] = P [I];} If (n> 1) m --; return m;} int main () {int N, CAS = 1; while (scanf ("% d", & N), n) {point P [507], CH [507], V [507]; int I; for (I = 0; I <n; I ++) {scanf ("% d", & P [I]. x, & P [I]. y, & P [I]. k); P [I]. id = I; P [I]. vis = P [I]. flag = 0;} Sort (p, p + N, CMP1); V [0] = P [0]; for (I = 1; I <n; I ++) if (P [I]. k! = P [I-1]. k) break; else {v [I] = P [I]; If (P [I]. X = P [I-1]. X & P [I]. y = P [I-1]. y) P [I]. vis = V [I]. vis = P [I-1]. vis = V [I-1]. vis = 1 ;}int num = I; int M = convexhull (v, num, CH); If (P [0]. k = 0) num = 0; for (I = 0; I <num; I ++) for (Int J = 0; j <m; j ++) if (Cross (CH [J]-ch [(j + 1) % m], CH [J]-P [I]) = 0) {If (! P [I]. vis) P [I]. flag = 1; break;} Sort (p, p + N, cmp2); printf ("case # % d:", CAS ++); For (INT I = 0; I <n; I ++) printf ("% d", P [I]. flag); printf ("\ n");} return 0 ;}


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.