### justHusam's blog

By justHusam, 4 years ago,

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.

• +61

 » 4 years ago, # |   0 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.
•  » » 4 years ago, # ^ |   0 because you choose for each row all available columns that can match with it and vice versa ..because the result of multiplying matrix A by matrix B differ from multiplying matrix B by matrix Asome thing like this142 32 33 23 2all available pairs of indices i and j exist are 8(1 , 3)(1 , 4)(2 , 3)(2 , 4)(3 , 1)(3 , 2)(4 , 1)(4 , 2)
•  » » » 4 years ago, # ^ |   +4 Thanks.
•  » » » » 4 years ago, # ^ |   +3 :)
•  » » » » » 4 years ago, # ^ | ← Rev. 2 →   0 Hi, this is my sol http://codeforces.com/gym/101502/submission/31438210 but I don't know how to do with case x==y, can you help me ? :<
•  » » » » » » 4 years ago, # ^ |   0 check data types
 » 4 years ago, # |   0 How to solve problem J ?
•  » » 4 years ago, # ^ |   +1 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, Spoilerif (a>b) return 0; return max(t[a] + min(solve(a+2,b),solve(a+1,b-1)) , t[b]+min(solve(a,b-2),solve(a+1,b-1)) ); you'll also need a dp table to memoize the score for each pair (a,b)my solution
•  » » » 4 years ago, # ^ |   0 thanks a lot :)
 » 4 years ago, # |   0 For problem A can anybody give a HINT and thanks in advance ^^
•  » » 4 years ago, # ^ |   0 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 × OrangePriceLet'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.25The 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 ≡ TotalMoneySo, we can write the equation as follows:Also, we know the following from the explanation above:TotalMoney ≡ Oranges × OrangePriceNewOrangePrice ≡ OrangePrice × 1.25So, 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:.
•  » » » 4 years ago, # ^ |   +3 I Got it ,This is a Good Explanation Thanks :D
•  » » » 5 weeks ago, # ^ | ← Rev. 2 →   0 .
 » 4 years ago, # | ← Rev. 2 →   0 IS here anyone can put the solutions of the 12 pbs here please ?
 » 4 years ago, # |   0 Can anyone share how to solve problem I. Was it a simple BFS but it was giving Wrong Answer on my submission.
•  » » 4 years ago, # ^ |   +4 We can find the current number of other figures can be reached, the establishment of a map, the shortest road
•  » » » 4 years ago, # ^ |   0 it will do a BFS ?? as the graph would be undirected or am i missing something
•  » » » » 4 years ago, # ^ |   +4 Yes, no direction
•  » » » » » 4 years ago, # ^ |   0 got it Thanks :)
 » 4 years ago, # |   0 Can anyone give me hint with problem D ?
•  » » 4 years ago, # ^ | ← Rev. 2 →   0 BFSand 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
•  » » » 4 years ago, # ^ | ← Rev. 2 →   0 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 ?
•  » » » » 4 years ago, # ^ |   0 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.
•  » » » » » 4 years ago, # ^ |   0 thanks, I will read trie
 » 4 years ago, # | ← Rev. 2 →   0 problem B ~~~~~ public static void main(String[] args) { MyScanner scanner=new MyScanner(); int test=scanner.nextInt(); while(test-->0){ int length=scanner.nextInt(); int[] rowArray=new int[length]; int[] colArray=new int[length]; HashMap colCount=new HashMap<>(); for(int i=0;i
•  » » 3 years ago, # ^ |   0 In case you haven't solved your issue yet, I believe I had the same problem. The result can be up to N choose 2, which exceeds the size of an integer, so you must use a long.
 » 3 years ago, # |   0 Hints for L?I see that m is quite small, which suggests a solution in exponential time...