All submissions for this problem are available.
A scientist was performing an experiment with two particles, particle A and particle B. the two particles follow all the properties of light(ie. the particle travel in straight line). He placed the source of particle A at location (x1,y1) and B at (x2,y2). But he found out that area in which both particles can meet in his room is very large and it becomes difficult to observe such large region. So he introduced some obstacles like circular pillar and walls which absorbs particles falling on it and thus some region do not recieve particle A, while some did not recive particle B, but there were some regions which could recieve both A and B. Thus area under observation is reduced by significant amount.
Find the area of the region which scientist needs to observe (i.e. area which can recieve both A and B). Assume that the room is a sqaure of size 100x100(0<=x,y<=100).
1st line Number of test cases
1st line of each test case gives values of x1,y1 (position of source of A)
2nd line gives values of x2,y2(position of source of B)
3rd line contains number of pillars in the region (N)
3rd line is followed by N lines which give 3 numbers x y r. (x,y)-location of pillar and r- radius of the pillar.
Area of region common to both particle A and B.
(answer upto only 2 decimal places required).
Input: 78 38 1 95 1 35 38 14 Output: 6846.87
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.5, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.