Angles
Practice
3.9 (19 votes)
Dynamic programming
Math
Medium
Number theory
Problem
74% Success 2668 Attempts 30 Points 5s Time Limit 256MB Memory 1024 KB Max Code

Raju and Rani and playing games in the school. Raju has recently learned how to draw angles. He knows how to draw some angles. He also can add/subtract any of the two angles he draws. Rani now wants to test Raju.

Input:
First line contains N and K, denoting number of angles Raju knows how to draw and K the number of angles Rani will tell Raju to draw.
Next line contains, N space separated integers denoting the angles which Raju knows how to draw. Next line contains K space separated numbers denoting the angles Rani wants Raju to draw.

Output:
For each of the K angles Rani wants Raju to draw, output "YES" or "NO" (quotes for clarity) if he can draw those angles or not respectively.

Constraints:
\(1 \le N,K \le 10\)
\(0 \le All\; angles \le 360\)

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
2 votes
Tags:
AlgorithmsApprovedDynamic ProgrammingFenwick TreeMediumSegment TreesSorting
Points:30
15 votes
Tags:
AlgorithmsApprovedEasyMediumOpen
Points:30
331 votes
Tags:
Medium