### justHusam's blog

By justHusam, 7 months ago, ,

Hello Codeforces,

I would like to invite you all to participate in the 2019 JUST Programming Contest of Jordan University of Science and Technology. The contest was originally held on $23^{rd}$ of March, and it will launch in Codeforces Gym on Friday, 29 March 2019, 13:00 UTC.

The problems were prepared by justHusam (Husam Musleh), Aristos (Hamzeh Sahyoun), Lvitsa (Alaa Abu Hantash), H2A_TLE (Asem Al-Radaideh), and Thunder_r (Bara' Al-jawarnEh).

Thanks to Mockingjay (Sarah Abu Elayyan) 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!

Update: Registration is now open.

Update: The contest has ended. Congratulations to all participants!

You can check the scoreboard of the onsite contest on the following link.

• +60

 » 7 months ago, # |   +11
•  » » 7 months ago, # ^ |   +11 JUST already did it. You should be Jordanian to understand how XD.
 » 7 months ago, # |   +14 How to solve A and L?
•  » » 7 months ago, # ^ |   +9 For L , the problem is very similar to IOI 2010 Quality of living , you can see here my solution to it and with explanation , don't forget to use scanf and printf because normal input and output will make TLE.
•  » » 7 months ago, # ^ | ← Rev. 2 →   0 A: you may have already noticed this is a graph problem, with the cards being edges, and the nodes containing a character.For every non-bridge edges in the graph, change their weight to 0 (since we can just wand them instead). Build a minimum spanning tree over these edges. Root this tree anywhere you like. Now for each A/H character in the tree you'd want to "lift" them up, moving them closer to the root, until they meet their counterpart character.
 » 7 months ago, # |   0 Can anyone tell why we need dp in D? Where greedy solution fails? I am not able to find case where it fails? Code
•  » » 7 months ago, # ^ |   +6 Check this test case: $0001000010$ $1111111011$ $0101001000$Your code output is "1111111100", while the correct answer is "1111111111".
•  » » » 7 months ago, # ^ |   0 Can you share the approach to solve D?? I tried solving Greedily but getting WA.
•  » » » » 7 months ago, # ^ |   +3 Try every permutation of the first two strings, then you can greedily match the 3rd
•  » » » » » 7 months ago, # ^ |   0 My intitial solution was the same as you mentioned. But after a rough calculation I thought it will not fit in time limit. As it's time complexity will be roughly O(T * 252 * 252 * 10); As maximum permutation of a string will be max 252 (i.e. five zero's and five one's).Example :T = 250for every T all the three strings be same 1111100000.
•  » » » » » » 7 months ago, # ^ |   0 Not very surprising :) The 1e8/1s bound is a simple approximation. As long as you don't do anything too costly, it should pass smoothly. I used that approach and passed in 233ms. In one problem I did O(M*2^N) for N = 19, M = 5000 and it passed in 2.3sI suppose it comes down to optimization skill and confidence for one particular problem.
•  » » » » » » » 7 months ago, # ^ |   0 Mine too got an AC in 265ms. But if we consider the test case i mentioned above i don't think that our solution will work on it within given TL.
•  » » » » » » » » 7 months ago, # ^ |   +3 You have a point. My code runs on 1500ms for your case :) looks like I found an unintended solution.
•  » » » » » » » » » 7 months ago, # ^ |   0 can you check this code please for problem D
•  » » » » » » 7 months ago, # ^ |   0 Actually you only need to try all permutations of the second string, first one can be fixed (or vice versa) and then greedily match from the third. The complexity is now around $O(T * 252 * 10)$ and my accepted code runs in 15ms.
 » 7 months ago, # |   0 Hi there, can anyone help me find a counter case for problem D code I tried a lot of cases but it seems to work, I cannot find a counter case
•  » » 7 months ago, # ^ |   0 Check this test case: $1111110000$ $1001001110$ $0100001001$Your code output is "1111111100", while the correct answer is "1111111111".
 » 7 months ago, # |   0 How to solve C — Large GCD?
•  » » 7 months ago, # ^ |   0 Hintthis is a trick question , can be solved in O(1)
•  » » » 7 months ago, # ^ |   0 Actually we had to print some output by bruteforce solution, then we would observe that output is always 2 or 12.
•  » » » » 7 months ago, # ^ |   0 Exactly
•  » » 7 months ago, # ^ |   +3
 » 6 months ago, # |   +7 Any editorial for this contest?
 » 6 months ago, # |   0 How to solve K?
•  » » 6 months ago, # ^ |   0 Lets fix the left barrier of the subarray. A key insight in this case is to note that we can't get more than log_a different results as we keep expanding to the right. Why? The OR result is always non-decreasing. Either it stays the same, or one or more bits get turned on. So, every different result turns on at least one new bit, but we only have log_a bits, so the possibilities are limited to this number.Having this insight, for every left barrier i ( from 1 to N ) we can do the following. Start with a range [i,i]. Insert the OR of the range to a set. Then, as long as we can keep expanding our right barrier, binary search the closest right barrier that increases the OR of the range. When we find it, insert the OR of the new range and repeat. Stop when we can't find a new OR. We will try N different left barriers, and in each one we will make at most log_a binary searches. To calculate the OR of a range quickly we can use a sparse table. This would give us a complexity of N*lgN*lgA that fits perfectly in time.
•  » » » 6 months ago, # ^ |   0 Thank's
 » 6 months ago, # |   0 Any tips for problem k?
•  » » 6 months ago, # ^ |   0 https://ide.geeksforgeeks.org/qorNuMmBI1 link to code for k
•  » » » 5 months ago, # ^ |   0 Wow! Can you explain why this works?