Codeshark round #1 — A2 and A3

Revision en1, by dario-dsa, 2015-06-30 14:36:10

Hi ,
I solved A1 like everybody else but now I have problems with A2 and A3. My main idea is not that special, try every number for P and generate all possible q and stop if you enter in the circle with map, so that idea is O(N^2) and that is not good. Can anyone help me and say some suggestion for that problem.
Task link

Tags codefoces, c++

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English dario-dsa 2015-06-30 14:36:10 409 Initial revision (published)