Submit | All submissions | Best solutions | Back to list |
KUTH - Kutevi Hard |
One day Mirko was cleaning up his room and found a straightedge and a compass. He went to the school the next day and challenged his friend Slavko to a geometric construction battle. Mirko knows how to construct some angles using the straightedge and compass and knows how to subtract and add any two angles he constructs. Slavko now shouts random angles and Mirko must draw them as fast as possible. You are observing this battle and would like to know if Mirko can construct the angles Slavko shouts at all.
Input
The first line of input contains two integers, N (1 ≤ N ≤ 100000), number of angles Mirko knows how to construct initially and K (1 ≤ K ≤ 100000), number of angles Slavko selected. The second line of input contains N positive real numbers with exactly 6 decimal digits, all smaller than 360, the angles Mirko knows how to construct initially. The third line contains K positive real numbers with exactly 6 decimal digits, all smaller than 360, the angles Slavko selected.
Output
Output consist of K lines, one for each angle Slavko selected. The i-th line should contain "YES" if Mirko can construct the i-th angle, and "NO" otherwise.
Example
Input: 2 1 30.000000 70.000000 40.000000 Output: YES
Input: 1 1 100.000000 60.000000 Output: YES
Input: 3 2 10.000000 20.000000 30.000000 5.000000 70.000000 Output: NO YES
Added by: | Stjepan |
Date: | 2009-12-04 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 NODEJS OBJC PERL6 SQLITE VB.NET |
Resource: | based on problem "Kutevi" (COCI 09/10, #2) authored by Bruno Rahle |
hide comments
2010-07-23 22:21:06 stjepan
@sudipto das Your first submission has rounding problem. |
|
2010-07-23 22:12:21 stjepan
@Ravi Kiran scanf("%lf") works just fine. |
|
2010-07-01 04:12:04 sudipto das
most irritating problem i've faced ever...got serveral WA though logic was correct frm 1st submission!!!!!!! atlst got ac by doing some nonsense!!! |
|
2010-06-25 06:44:52 Ravi Kiran
C and C++ users beware!!Dont get tempted in using scanf("%lf") to read input. It will result in WA!Took me 5 Wa's to understand that! |
|
2010-02-23 23:03:23 stjepan
If he applies an angle of size 100 15 times, he gets: 15*100 = 1500 = 360*4+60, so he can draw 60 Last edit: 2010-02-23 23:03:33 |
|
2010-01-24 15:33:53 Reborn In Fire...
shouldn't mirko be unable to draw 60.000000 with only a 100.000000? |
|
2009-12-08 22:02:01 stjepan
Problem statement is not unclear, you should be able to answer your questions yourself. And the answers are quite obvious. :) |
|
2009-12-06 08:16:44 stjepan
Thanks for your feedback. I have increased time limit to 1 second and ran rejudge. |
|
2009-12-06 08:16:44 [Trichromatic] XilinX
This problem tells us constant and I/O optimization are nessassary sometimes, even though I hate this type of problems. Last edit: 2009-12-04 10:10:44 |