### Hasan0540's blog

By Hasan0540, 10 months ago, ,

Hello Everyone,

The problem set of 2017 ACM Jordanian Collegiate Programming Contest will be available in Codeforces Gym on Saturday, Nov/11/2017 18:00.

The problems were prepared by Hasan0540, justHusam, Alaa_AbuHantash, and Maram Tuffaha. Thanks to ahmed_aly for reviewing the statements and giving some suggestions.

Note that your solution should read the input from file and write to the standard output. You can find the input file name below the title of the problem.

Hope you like the problems. Any feedback is appreciated!

Good luck!

•
• +54
•

 » 10 months ago, # |   0 The contest will start in 25 minutes. Don't forget to read the input from file.
 » 10 months ago, # |   0 I just see him in top 10 and finaly, he skipped... I don't understand???...
•  » » 10 months ago, # ^ |   +2 Maybe I didn't like problems and skipped
 » 10 months ago, # |   0 Hello,I tried to solve the question M Winning Cells but I had no idea about it,could you please tell me how to do it?
•  » » 10 months ago, # ^ | ← Rev. 2 →   0 You should run naive algorithm will be see tricky in this problem... And when you see that, everything will be easy...
 » 10 months ago, # | ← Rev. 2 →   +5 What is the tricky test case for problem H? 1 hour of stress-testing couldn't find any.
•  » » 10 months ago, # ^ | ← Rev. 2 →   0 1 9 +.+...... The correct answer is 2.Not sure if it's tricky, but this is the first case you got WA on.
•  » » » 10 months ago, # ^ | ← Rev. 2 →   0 Thanks for the test case. It seemed that even stress-testing sometimes can't help you finding the mistake in your solution. I will take note of this.By the way, it seemed that you gathered all of the test cases in a single test (test 2). Is there a specific reason for you to do that?
•  » » » » 10 months ago, # ^ |   0 I think in such problems it is better to generate all possible cases of some length (2^length — 1).We still use an old stable version of PC^2 in the onsite contest that doesn't support multiple test files.
•  » » » 10 months ago, # ^ |   +8 lol my stress test generated exactly the same testcase :'D
 » 10 months ago, # | ← Rev. 2 →   0 quailty Can you share the idea behind your solution for problem I?
•  » » 10 months ago, # ^ | ← Rev. 3 →   +8 Sure. My solution mainly considers the center of mass. It seems that the center of H is the nearest from itself and the center of M is the farthest. So I take the minimum and the maximum distance between the center and the pixels and calculate the ratio. Since the difference is not so big, the thresholds should be taken carefully.By the way, thanks for the interesting problem set.
•  » » » 10 months ago, # ^ | ← Rev. 2 →   +14 Thank you for sharing your solution, I thought all solutions for this problem will be similar! :)The intended solution has one constant and I think it is easier to set, I'll explain it if anyone is interested:For each black component, find the longest path as we do in trees (start from any cell, find the farthest cell and start again from it), this path is not really the longest but this way we have two ends of different branches. As the font has some thickness, we need to extrude the cells on the path. To do this, we can start multi-source BFS from the cells on the path and run BFS for Length * R iterations, where Length is the length of the path we found, and R is an estimated ratio between the thickness of the font and the length of the path that ensures we cover the thickness of the font, any value between 0.12 and 0.25 will get accepted. Finally, we count the number of components with unvisited cells (black components in the picture above) and decide what is the letter: 0 = M, 1 = Y, and 2 = H.
 » 9 months ago, # |   0 Can anyone give me a hint for problem G: HERE
•  » » 7 months ago, # ^ |   0 Two Pointers or Binary Search with Prefix Sums for each bit.
 » 4 months ago, # |   0 Can someone share his solution of problem H (Gas Stations) ?