justHusam's blog

By justHusam, history, 6 years ago, In English

Hello Codeforces,

I would like to invite you all to participate in the 2018 JUST Collegiate Programming Contest. The contest was originally held on 31st of March, and it will launch in Codeforces Gym on Saturday 28 July 2018 10:00 UTC.

The problems were prepared by justHusam (Husam Musleh), Lvitsa (Αlαα Abu Hantash), and Roze (Nada Al-Shamayleh).

Thanks to Dark (Hamza Zagha), Ptrq (Mohammad Dehayat), and AbedAbuhijleh (Abed Abu-Hijleh) for testing the problem set.

The duration of the contest is 4 hours, and the registration will be open 6 hours before the start of the contest.

Good luck to everyone, and I wish you all accepted solutions.

UPD: Registration is currently open.

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

| Write comment?
»
6 years ago, # |
  Vote: I like it +14 Vote: I do not like it

The difficulity of problems is Div.3 or Div.2???

»
6 years ago, # |
  Vote: I like it +14 Vote: I do not like it

How to solve problem G-Hard Equation ?

  • »
    »
    6 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    In problem G, you are required to solve the Discrete Logarithm Problem. You can use the Baby-step giant-step algorithm to solve the problem.

    • »
      »
      »
      6 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      How can we calculate modular inverse since it is not necessary that a and m are co-prime.

      • »
        »
        »
        »
        6 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        I'm not sure why computing the inverse step is mentioned in Wikipedia, but it is not necessary. Check this tutorial from GeeksforGeeks.

        • »
          »
          »
          »
          »
          6 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          The tutorial on GeeksforGeeks also only work when a and m are coprime. Otherwise, the expression is not always true, for example with a = 4, b = 1, m = 10, i = 2, j = 4.

          I don't know what to do next from here. Any suggestion?

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

Is there an editorial?

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

how to solve problem E. Maximum Sum ?

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

    You can solve it using dynamic programming. Think of it as if you want to calculate the answer of the of row i, then you only care about which cells you have chosen in the row i - 1. Or you can think if you want to choose cell (x, y), then you only need to check if you have chosen cells (x, y - 1), (x - 1, y - 1), (x - 1, y), and (x - 1, y + 1).

    • »
      »
      »
      6 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      thanks!

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Sir, can you provide more detailed editorial or a code for solution to this problem. It will be helpful in learning it more deeply.

»
6 years ago, # |
  Vote: I like it 0 Vote: I do not like it

What testcase was added to B after the contest?

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

    A contestant sent me a message with a test case that can break some accepted solutions after the contest has ended, so I updated the test cases. I prefer not to tell you about the test case so you can discover your mistake by yourself =D.

»
6 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

how to solve problem A?

»
6 years ago, # |
  Vote: I like it 0 Vote: I do not like it

what is the solution for I circles?? its giving tle in test 2

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

    make sure you are using fast I/O, because time limit is very tight if you are using cin with doubles or just take the input as integers not doubles.

    • »
      »
      »
      6 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I used fast io bt used doubles.. Will check for integers.. Thanks

»
6 years ago, # |
  Vote: I like it 0 Vote: I do not like it

any hint for C. intersections??

»
6 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Can the administrator please open the solution of all users??

  • »
    »
    6 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I am agree with you sir!!! Please open solutions as sir demanded.

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

There are some greedy solutions that do pass on problem B. Check this testcase:

1
4
2 5 10 14
M M F F

Solution is 2.

  • »
    »
    6 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    In the question it is given that all triplets are co-primes but 2,10 and 14 are not co-primes.

    • »
      »
      »
      6 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Right sorry but look at this case:

      1
      4
      10 21 55 6
      M M F F
      

      Solution is also 2 (pair 10 with 55 and 21 with 6), but wrong greedys will pair 10 with 6, and the 21 can't be paired with 55.

      Some codes that fail this testcase:

      code 1

      code 2

      code 3

      code 4

»
6 years ago, # |
  Vote: I like it 0 Vote: I do not like it

https://paste.ubuntu.com/p/77VbmCM8Tg/ can someone say what is wrong with my code? it's the solution for the k problem.

»
5 years ago, # |
  Vote: I like it 0 Vote: I do not like it

How to solve C intersection?