I_love_Tanya_Romanova's blog

By I_love_Tanya_Romanova, 3 years ago, In English,

Hello Codeforces!

Have you heard about HackerEarth Collegiate Cup? Here is a general invitational post about it — Invitation to HackerEarth Collegiate Cup. In case you missed it, or failed to qualify for the next round, I have a nice surprise for you — there will be a Wild Card Round which wasn't mentioned in original announcement. This contest will take place on October 02, 10:00 IST.

This contest will give another chance for all those who didn't qualify or missed the previous rounds to directly get into the Second Elimination. Top 20 teams will directly qualify for the Second Elimination. Make sure you will have 3 members in your team and all from same college.

This contest will be held using ICPC-style rules (penalties, no partial scoring). You'll have 2 hours to solve problems prepared by Yury_Bandarchuk and kingofnumbers. I worked on it as a tester, and after the contest you'll have editorials by magieNoire provided.

Good luck! See you on the leaderboard. And in the Second Elimination afterwards ;)

 
 
 
 
  • Vote: I like it
  • +17
  • Vote: I do not like it

»
3 years ago, # |
  Vote: I like it +9 Vote: I do not like it

What is the solution for the Prime Numbers question?

  • »
    »
    3 years ago, # ^ |
    Rev. 3   Vote: I like it +6 Vote: I do not like it

    Most difficult part in this problem is check number for prime. Let our sequence will be a=a1->a2->...->an=b. Let's make some observations:

    1. if (b-a) — prime number then answer a->b

    2. Between numbers x, x+2, x+4, always exist non-prime number if x>3

    3. if a > 3, then if we add or subtract prime number >= 3 we will get even number, so we need to reach 2 somehow, otherwise we can't reach number b, because b is odd + points (1) and (2). How we can do this? If (a-2) — prime, everything is OK. In another case, we can add or subtract 2 from a (twin primes), and after that recieve 2. If we can't reach 2 after these operations there is no answer. If we'll try to solve problem for pair b, from b reach 2, and combine answer. For 37,71(37->39->2->73->71), for 3,13(3->5->2->13). Everywhere will be 2

    4. if a = 2, then try to get (b+2) or (b-2) and after that b

    5. if a = 3, then if b = 7, answer 3->5->7. Otherwise solution like (3)

    Code: http://pastebin.com/FP4NVWT5