Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

Блог пользователя codebook_2000

Автор codebook_2000, история, 19 месяцев назад, По-английски

Algomaniac Banner

Hi Everyone,

We are delighted to invite you to participate in Algomaniac 7.0, conducted by JU EE Students' Forum as one of the flagship events of CONVOLUTION 2023, the Annual technical fest of Department of Electrical Engineering, Jadavpur University.

The event will be held in 2 rounds- the Prelims and the Finale.

PRELIMS ROUND

The Prelims will be an individual programming contest, held online. Participants will get 2 hours to solve 6 algorithmic problems.

FINALE ROUND

The top participants of Prelims would be shortlisted for the Finale Round to be held in offline mode at the Department of Electrical Engineering, Jadavpur University on $$$26^{th}$$$ March 2023.

PRIZES

  • Exciting goodies would be provided to the finalists
  • Cash prizes and Goodies worth INR 15000 for top 3 contestants

Note: To be eligible for the prizes and goodies, participants must fill the Registration Form and must participate in the Finale offline on $$$26^{th}$$$ March.

Testers and Setters: merlin_, codebook_2000, Psychotic_D, Arima_Kun, arkaprovo02, Sabarno15102002, anonymous_warrior, batak

We sincerely expect your presence and hope you will enjoy solving the problems alongside learning a lot in the course of the event!

Happy Coding!

UPD 1: Deadline for Registration is 16th March, 03:00 PM IST

UPD 2: Contest timing has been updated. Please check out the new timing in the description!

  • Проголосовать: нравится
  • +23
  • Проголосовать: не нравится

»
18 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by codebook_2000 (previous revision, new revision, compare).

»
18 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Good to see a JU contest in CF !

»
18 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

The prelims are clashing with the 1st Stage of COD-COM . Can you please reschedule.

  • »
    »
    18 месяцев назад, # ^ |
      Проголосовать: нравится +3 Проголосовать: не нравится

    We set the date 5 days ago, specifically as there were no contests that on 16th..Its hard but we are trying to look for a common ground.

    • »
      »
      »
      18 месяцев назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      Now it is also clashing with the ICPC Mathura practice round. Can you please reschedule.

      • »
        »
        »
        »
        18 месяцев назад, # ^ |
          Проголосовать: нравится +1 Проголосовать: не нравится

        We have rescheduled the timing taking into account all the contest clashes and the feasible timings possible from our side. Check out the new timing!

»
18 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

How to solve "Playing With Primes" ?

I was trying 3 times / 2 times (product of remaining primes iff size pf <= 2) / the number is already a product of 2 primes.

Can anyone tell me their approach to solve this problem? I think my approach will fail for case like , when n = 17.

»
18 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Was n^2 the intended solution for Playing with primes, because it passed(I tried it after the contest), or am I missing some calculations?

My code for reference: code

  • »
    »
    18 месяцев назад, # ^ |
    Rev. 2   Проголосовать: нравится +4 Проголосовать: не нравится

    As the setter, my idea was a bit constructive(?) in nature.

    It is a known fact every even number >2 can be represented as the sum of 2 primes.
    So we can say 2*(even number >2) = prime*prime + prime*prime.
    Thus our problem is, remove a number $$$x$$$ which is a product of 2 primes such that $$$n-x$$$ is divisible by 4.

    This is actually pretty easy

    Now once you have a $$$n$$$ divisible by 4, you can just check if $$$n/2$$$ can be split into sum of 2 primes. If you see here, you will realize the smaller of these 2 primes is not actually very high, so this can be calculated pretty easily. My implementation is here.

    And finally to answer your question, your apparent $$$O(n^2)$$$ passes because the outer loop does not iterate at all. If a number is significantly large, it can be represented a sum of 2 prime products itself, with one of them being fairly small (if you have counter cases feel free). I had this observation as well, but I chose to stick with k<=3 because the soln seemed a bit more provable than just running loops and observing.

    PS: The contest was supposed to be in ACM ICPC format, due to some ignorance on organizing side the ranklist became the normal hackerrank one. I came to know about it after the contest began and was helpless. Also, since I have prepared the problems on polygon, and once the finals are over, I will add all of them to gym/mashup. I hope you and other participants (and non-participants) enjoy the problems.

    PPS: Little_Sheep_Yawn deserves special thanks for providing some valuable feedback to improve the problems.

    • »
      »
      »
      18 месяцев назад, # ^ |
        Проголосовать: нравится +8 Проголосовать: не нравится

      merlin_ really make a lot of effort and i had a great time testing the round. Too bad something unexpected happened.