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:||ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.3.2, CPP 6.3, CPP14, CS2, D, ERL, FORT, FS, GO, HASK, ICK, ICON, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, NODEJS, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.5, RUBY, SCALA, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC|
Fetching successful submissions
If you are still having problems, see a sample solution here.