Overlapping discsProblem code: M5 |
All submissions for this problem are available.
The problem statement has been updated.
The time limit for this problem is now 5 seconds.
You are given n discs on plane, of the same radius (r=1). Output the area of the part of the plane which is covered by each disc.
Input
First, 1<=t<=10, the number of tests. Each testcase is of the following form: 1<=n<=100000, then n pairs of floating point coordinates follow: -1000<=xi,yi<=1000, representing the location of the i-th disc.
Output
For each testcase, output the total area covered by the intersection of all discs. Round the answer to 6 decimal digits after the point.
Example
Input: 1 2 0 0 0 1 Output: 1.228370
| Date: | 2010-01-29 |
| Time limit: | s |
| Source limit: | 50000 |
| Languages: |
Comments

Fetching successful submissions 
I am pretty sure that my
I am pretty sure that my solution is correct, but I somehow
get SIGSEGV...
Are you sure both xi, yi are not greater than 1000 in test cases?
This is part of my code:
This is part of my code:
Indeed, now I get wrong answer instead of runtime error.
Please check test cases.
Wrong Answer why .. ? My
Wrong Answer why .. ? My solution is correct :(
Checking.
Checking.
what should be the value of
what should be the value of PI .. ?
There has only ever been one
There has only ever been one value of pi, and always will be.
The test cases are correct.
The test cases are correct.
Please clarify if PI be 3.14
Please clarify if PI be 3.14 or 3.1416 or having more sognificant figures .
@Lucky: Try 2.0*acos(0.0)
@Lucky: Try 2.0*acos(0.0)
I am sorry, I understood
I am sorry, I understood numbers are integers because of
sample test cases in text...
IMPORTANT: I changed
IMPORTANT:
I changed expected precision up to 6 digits after decimal.
MORE IMPORTANT: This
MORE IMPORTANT:
This problem is all about INTERSECTION of discs, not UNION of discs. I have no privileges to change it, lets hope some admin do it soon.
@Przemysław: I really love
@Przemysław: I really love most of your problems. Very challenging. But having to deal with significant changes to the problem statement (and especially changes to the judge) can be very annoying. It seems you're suggesting that the entire problem statement (as well as sample i/o) is completely wrong. How does such a mistake not get caught before the contest?
Which way should 0.1234565 be
Which way should 0.1234565 be rounded to six decimal places, up or down?
@Przemysławare are you the
@Przemysławare are you the problem setter?
But the sample input and output here looks as if its a union not intersection?
Surely it can't be possible
Surely it can't be possible that the description, output section, and sample output can all be wrong at the same time.
@Przemysławare Sample output
@Przemysławare
Sample output is UNION ? Is this wrong ?
Let us say three circles (A, B, C) intersect each other. So you are suggesting that insteaed of finding (A union B union C) we go for the common area by the three circles i.e. (A intersection B intersection C) or the area due to overlapping i.e. { (A intersection B) + (A intersection C) p+ (B interstion C) - (A intersection B intersection C) }
The problem statement as of now is Deceptive to the core .. IMHO, not to mention hard.
IMPORTANT This problem
IMPORTANT
This problem statement has been updated.
I'm glad this is the last
I'm glad this is the last problem I looked at!
I am seeing:
Notice that the date is later than on the other problems; more concerning is the missing time limit and languages lists.
@Mislav The test cases that
@Mislav The test cases that are provided in the problem statement in programming competitions generally do not cover all the important issues.
Do I understand this
Do I understand this correctly? More than 10 hours, most of them daylight hours, passed between the problem setter releasing a correction and an admin updating the problem statement? I am with David in wondering how these things happen. Only one person has submitted since the problem statement was changed. Hopefully someone will finally crack it, then I'll know it's worth trying.
@Tomasz printf("%.6lf", o
@Tomasz
printf("%.6lf",
ok?
Time limit is missing, it is
Time limit is missing, it is 2s for all testcases. I have no privileges to upload it to problem statement,
@Brian I made the change as
@Brian I made the change as soon as I saw the updated statement. Also, you are discounting the difference in time zones :)
@Przemysław What language is
@Przemysław What language is that statement in? C? There are different flavours of C, even before you count C++ and C#. This problem statement is missing the languages list, as I pointed out before, and CodeChef accepts several variations of C. Not everyone uses C, anyway. I think the original question was reasonable.
can the coordinates of centre
can the coordinates of centre be floating point numbers or they are strictly integer?
and if there are 10 discs then is the area to be calculated is the area common to all 10 of them or is it the sum of individual overlapping areas between any possible set of circles?
admin please clarify
Your first question is
Your first question is already answered.
You want to find just the area common to all circles.
@Brian Don't ask admin
@Brian
Don't ask admin related questions to me, I'm only problemsetter.
@Aashish read carefully
@Aashish
read carefully problem statement
IMPORTANT I increased time
IMPORTANT
I increased time limits here (5s on largest tests), because even my solution didn't fit into time limit. Sory for troubles, and I wish you nice problem solving from Harbin :)
a small question is the
a small question
is the common area is always between 2 circles only??
I mean is it possible that more that 2 circle share the same area??
@Przemysław: Thank you for
@Przemysław: Thank you for the increase in time limit. I was not looking forward to that optimization.
@Admin: Do I need to resubmit my solution to fix the rankings issues?
am i forced to output the
am i forced to output the last zeros as the sample output??
i mean if there is no
i mean if there is no intersection found then the area is zero
so the output will be :
0
or
0.000000
Given the large number of
Given the large number of problems with this problem, I'm inclined to ask this: can anyone confirm that the sample output is correct? I did it by hand and got a slightly different answer.
@Przemysław You responded to
@Przemysław You responded to question with the following code fragment:
printf("%.6lf",. I was asking what language that code fragment was written in. The answer is obviously C, but there are many different forms of C; does that code behave the same way in all of them? And people who aren't familiar with C still don't know the answer to Tomasz's question.None of this is an admin issue.
@Ahmed: my accepted solution
@Ahmed: my accepted solution prints exactly 6 digits after the decimal for every test case.
@Brian: the exact value is 1.228369something, where something is at least 5, and is therefore rounded up to 1.228370
The phrase 'answer should be
The phrase 'answer should be correct up to 6 decimal places' is standard phrase, and is no different from same phrase in hundreds of similar problems on spoj or codechef or other online judges.
I really shouldn't bother answering that question, and I was kinda suprised that Tomek asked that question. It was or joke, or disbelief in my solution.
@David So it is, I copied the
@David So it is, I copied the value incorrectly from my calculator somehow...
Can the OP give us one more
Can the OP give us one more test case: in floating points ofcourse as it's past 3 days with only 1 successful submission.
@Przemysław: It was a
@Przemysław:
It was a semi-joke question. But note that the problem doesn't say "answer should be correct up to 6 decimal places" or "errors up to 1e-6 are allowed". It says "Round the answer to 6 decimal digits after the point." which is more restrictive and means that arbitrary precision might be required to know which way to round.
i ve submited my code and it
i ve submited my code and it is saying wrong ans though i havechecked that my answers are absolutely correct though it might be taking a little more time then expected
can that be a possibility?
hey i m new to code chef this
hey i m new to code chef
this time i ve got time limit exceeded error can some one clarify tht does it mean my code was error free but violated time limit or it means computer stopped checking it after the specified deadline??
thanks in advance
Wrong answers means wrong
Wrong answers means wrong answer. Not right answer.
Time limit exceeded means time limit exceeded. Not right answer in too much time.
FAQ
@Tomek: I'll try to verify
@Tomek: I'll try to verify that small precision errors don't change answer. But maybe after the world finals :P
@Stephen: Thx.
@Przemek: Good luck.
@Przemek: Good luck.
@ admin for ur test cases my
@ admin for ur test cases my ans is correct i.e. 1.228370
if u put number of circles =1 then also ans is the value of pi i.e. 3.141593
if i shift the coordinates i.e. make 0,0 and 1,0 to 0,0 and -1,0 etc then again my ans is correct 1.228370
please give us one or two more test cases
i strongly believe my solution is correct
It isn't. Come up with your
It isn't. Come up with your own test cases.
big confusion with the
big confusion with the problem statement.. so just one question:
Do we have to find the area common to EVERY circle(all n circles)?? Yes or No? That will clarify the problem statement very nicely..
Thanks
@Shrikant The problem
@Shrikant The problem statement says to "... output the total area covered by the intersection of all discs". (emphasis added) The answer to your question is therefore "yes".
@Brian thanks a lot :)
@Brian thanks a lot :)
How many decimal places
How many decimal places points in input have?
@ brian supppose there are
@ brian supppose there are 10 discs .....and the maximum no of disc that are intersected to each other are 5 ...so do we have to find that area of 5 intersected discs or the loop comes out and say that not all the discs are intersecting so program terminated .....
@Bhavesh You always need to
@Bhavesh You always need to output an answer! In this case, the answer is zero. According to the answers above, you need to output "0.000000" (without the quotes).
spoj checker uses scanf to
spoj checker uses scanf to test outputs, so it is really no difference if you output 0, or 0.000, or -0.000000
Sometimes I get WA with 21
Sometimes I get WA with 21 seconds;
Sometimes I get TLE
Sometimes WA with 16 and so on....
Is time limit really very strict here ?
What is displayed as result
What is displayed as result when there are multiple input files? Is it type of error for first input, which is not accepted(TLE, WA, ...)? Or does our solution have to pass all inputs within time limit and only then are outputs checked for wrong answers?
I don't think so it's a error
I don't think so it's a error for first file....
After checking so many times .. I have confirmed that my solution is getting stuck in near to last cases
m newbie here its my first
m newbie here
its my first time
can u please tell me how to take input
whether as .txt file or somhw else???
@Tomaz I believe the result
@Tomaz I believe the result displayed is the type of error for the first input that fails. See the FAQ.