justHusam's blog

By justHusam, 7 years ago, In English

Hello Codeforces,

I would like to invite you all to participate in the 2017 JUST Programming Contest 3.0 of Jordan University of Science and Technology. The contest was originally held on 26th of August , and it will launch in Codeforces Gym on Wednesday 30 August 2017 15:00 UTC.

The problems were prepared by Vendetta. (Ibraheem Tuffaha), justHusam (Husam Musleh), Lvitsa (Αlαα Abu Hantash), and voxel (Mohammad Al-Tahhan).

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

Good luck for everyone, and I wish you all Accepted solutions.

UPD: Registration is currently open.

UPD: The contest will start in 30 minutes.

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

| Write comment?
»
7 years ago, # |
  Vote: I like it 0 Vote: I do not like it

For problem B can anybody explain why this approach gives WA: count the number of each a[i], and each b[i] inside a map countA and countB, then iterate one of the array and add the max of each element that it's count is > 0 in both maps (countA and countB) to the answer.

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

How to solve problem J ?

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

    let's suppose your lines of boxes starts with box with index a and finishes with box with index b, if you play first you can pick either box a or b, leaving the other player with boxes (a+1..b) or (a..b-1) and we know he will do the optimal move and leave us with either (a+2..b) or (a+1..b-1) (if we picked box "a" in the previous turn) and (a+1..b-1) or (a..b-2) (if we picked "b" in the previous turn). since this is a zero-sum game, we can think of his move as he's trying to minimize our score. so our next move will be in the position that gives us the minimum score. now let's go back to the beginning of the game before picking either a or b, we pick the box that gives us a maximum minimum in our next possible moves, and we do it recursively for all positions of boxes we can achieve. more formally,

    Spoiler

    my solution

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

For problem A can anybody give a HINT and thanks in advance ^^

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

    If the amount of money you have is TotalMoney, and the price per orange is OrangePrice then the number of oranges you can buy is (assuming that TotalMoney is divisible by OrangePrice):

    We can use this equation to find TotalMoney, which is equal to:

    TotalMoney = Oranges × OrangePrice

    Let's take the first test case as an example to explain the solution. If the price of the orange was increased by 25%, then the new price is equal to:

    NewOrangePrice = OrangePrice × 1.25

    The number of oranges that can be bought after the price increase is equal to:

    From the problem statement, we know that the amount of money didn't change, which mean:

    NewTotalMoney ≡ TotalMoney

    So, we can write the equation as follows:

    Also, we know the following from the explanation above:

    TotalMoney ≡ Oranges × OrangePrice

    NewOrangePrice ≡ OrangePrice × 1.25

    So, we can write the equation as follows:

    Which can be written as follows:

    In general, to calculate the answer you can use the following equation:

    .

    To avoid floating-point issues with compilers, you can multiply the equation by 100 to get the following equation:

    .

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

Can anyone share how to solve problem I. Was it a simple BFS but it was giving Wrong Answer on my submission.

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

    We can find the current number of other figures can be reached, the establishment of a map, the shortest road

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

      it will do a BFS ?? as the graph would be undirected or am i missing something

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

        Yes, no direction

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

Can anyone give me hint with problem D ?

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

    BFS

    and Remember that you can't do the following transitions:

    1 <-> 6 (ie: if top is 1, you can go to 3,4,5,2 but not 6, same for 6 can go the same set but not 1)

    3 <-> 4

    5 <-> 2

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

      Oh, I solved it , but very thanks you , btw, I am stuck at problem G, my idea is count hash code of all strings's suffix, but I don't know how to map value ?

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

        Hmmm, you approach seems like it'll get a TLE for me.

        Anyway, the problem is solvable by inserting the reverse of each string in a Tries. Think about it.

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

Hints for L?

I see that m is quite small, which suggests a solution in exponential time...