### ir5's blog

By ir5, history, 4 years ago, ,

Hi,

I would like to invite you to Kyoto University Programming Contest (KUPC), which will be held on 2 Oct. (4:00 — 9:00 GMT). Problem writers consist of several students in Kyoto University. The contest will be held on AtCoder.

The contest duration is 5 hours, and there will be 11 problems. KUPC has been held every year for about 5 years in Japan, but this is the first time to provide English problem statements.

I participated in the test round of this contest. The first a few problems are easy, so I'm sure everyone can enjoy the contest. On the other hand, a few problems from the last are probably interesting and though enough for high rated coders. We hope lots of people will compete in our contest. Good luck and have fun.

• +95

 » 4 years ago, # |   +23 As far as I know, KUPC has been one of the most intetesting contests in Japan. I believe this year's KUPC will be even more enjoyable. So I highly recommend you to participate in the contest :)))) Don't miss it!
 » 4 years ago, # |   +16 Is it rated? I can't find anything in the blog or the contest link.
•  » » 4 years ago, # ^ |   +13 It is not rated.
 » 4 years ago, # | ← Rev. 2 →   +16 Will there be editorials?If not, how to solve anything starting from Problem E. :)
 » 4 years ago, # | ← Rev. 2 →   +5 Wondering how to solve problem EI thought that for goats close enough(|dx| ≤ 2 and |dy| ≤ 2), the optimal solution would be the convex hull of surrounding points of these goats. And convex hull shall be caculated respectively for goat flocks (am I right using flock?) far away. But it was wrong. This solution even passed less data points than another solution calculating convex hull for all goats.
•  » » 4 years ago, # ^ |   +13 Ok after reading someone's code, I think I get the idea (not sure if it's complete) :Construct a flow graph where the outer layer of the grid (i.e. the area around the grid, outside the grid) is the source, and the Xs are sinks. Let the empty squares has capacity 1 and the Xs has capacity ∞. Also, there is an edge from a square to an adjacent square with capacity ∞. Now, the maximum flow of this graph is the answer. I think this is true because otherwise there would be an augmenting path from the source to sink, so the sheeps can escape.
•  » » » 4 years ago, # ^ |   +10 Yeah, it's the Max-flow Min-cut theorem
•  » » » 4 years ago, # ^ |   0 Another construction of flow graph I learned from other's code is like this:There's a source src and a sink dst.For every cell in the input, there's two vertices, say, ui and vi, where i is the id of the cell, H * W at most. (You can imagine they are two copies of layer of the input)For every 'X', there are two edges: One connecting src and ui with capacity inf. Another connecting ui and vi with capacity inf.For every '.', there is an edge connecting ui and vi with capacity 1.For every cell that is on the border of the input, there is an edge connecting vi and dst with capacity inf.For every cell whose id is i, there are edges connecting its neighbours back from vi to uj with capacity inf, where j is the id of its neighbours.But I still can't understand why minimum cut(or maximum flow) is the answer. Though there is some intuition, I can not convince myself about this...
 » 4 years ago, # |   +5 Any ideas on how to solve G? I couldn't figure out how to use the second condition.
•  » » 4 years ago, # ^ |   +5 The condition is confusing, but the solution isn't: just take all distinct substrings of length L (for the best L).To prove this, note that the second condition on strings of equal length is just "the strings are different", and if there is any smaller substring in the set, you don't lose anything by adding characters to the beginning or end of it, as you're only making it harder for the second condition to be violated.
 » 4 years ago, # |   +18 I see people with short solutions for H. What is the correct idea to solve the problem?
 » 4 years ago, # |   +5 I might be missing something really obvious but I can't come up with a proof for the solution to C. Can somebody kindly help me out? The solution I 'guessed' was to just use Y=127 every time.
•  » » 4 years ago, # ^ |   +36 The parity of the number of times each bit is set in the final set of numbers is fixed. This means that any solution that has more bits set in a position than your solution has at least 2 more bits set in that position, which is impossible since in your solution at most one bit is not set in each position (the one from the number which is not 127).
•  » » » 4 years ago, # ^ |   0 That's awesome, thanks a lot!
 » 4 years ago, # | ← Rev. 3 →   +5 FYI The editorial is out (in Japanese though) : linkIt would be nice if someone could explain editorials for HIJK (got stuck halfway using Google Translate)