Блог пользователя chokudai

Автор chokudai, история, 6 лет назад, По-английски

We will hold M-SOLUTIONS Programming Contest 2020.

The point values will be 100-200-300-400-500-600.

We are looking forward to your participation!

  • Проголосовать: нравится
  • +94
  • Проголосовать: не нравится

»
6 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится -9 Проголосовать: не нравится

.

»
6 лет назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

Happy :)

»
6 лет назад, скрыть # |
 
Проголосовать: нравится +42 Проголосовать: не нравится

let's hope that the difficulty is similar to the ABC's.

»
6 лет назад, скрыть # |
 
Проголосовать: нравится +11 Проголосовать: не нравится

Nice and interesting problems.

»
6 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

How to solve E and F?

  • »
    »
    6 лет назад, скрыть # ^ |
    Rev. 2  
    Проголосовать: нравится +8 Проголосовать: не нравится

    For F case where they collide head on is trivial (store and upper bound for each plane on that line going in the opposite direction).

    Notice otherwise that if any two planes must collide, they must lie along a common diagonal of the appropriate type. For example, if we have a plane going up at 0, 0 and one going left at 3,3 they will collide (as would any two planes on this diagonal such that a lower one went up and a higher one went left), I store the info for every diagonal of each pair of directions that can collide and find the closest one of the other type by upper bounding for each of them, but there should be an easier way to implement it I guess.

»
6 лет назад, скрыть # |
 
Проголосовать: нравится -7 Проголосовать: не нравится

How to solve problem E?

  • »
    »
    6 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +21 Проголосовать: не нравится

    I got AC simply by enumerating all the possible deployments of the rails.

    Key observation: a rail must be put across one site(residential area).

    First, enumerate the sites to put a rail across it. Then, enumerate the direction of the rails. Finally you can easily calculate the answer.

    The time complexity should be $$$O(3^N N^2)$$$.

    See my code here: https://atcoder.jp/contests/m-solutions2020/submissions/15450219

    PS: You can see it's running pretty slow but I think it's easy to think of.

  • »
    »
    6 лет назад, скрыть # ^ |
    Rev. 2  
    Проголосовать: нравится +33 Проголосовать: не нравится
    Solution
    EDIT
»
6 лет назад, скрыть # |
 
Проголосовать: нравится +15 Проголосовать: не нравится

Any cleaner or simpler way to solve F than solving for both the axes and all 4 diagonals individually ?

  • »
    »
    6 лет назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    I have the same doubt the code became too ugly

  • »
    »
    6 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +3 Проголосовать: не нравится

    My Submission. (might be helpful)

  • »
    »
    6 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +7 Проголосовать: не нравится

    I did solve all 6 cases individually, but I wrote code that was relatively reusable for all 6 cases, so it wasn't too bad.

    So my code ended up looking like this:

    answer = Math.min(answer, f(R, L));
    answer = Math.min(answer, f(U, D));
    answer = Math.min(answer, f(U, L));
    answer = Math.min(answer, f(R, D));
    answer = Math.min(answer, f(D, L));
    answer = Math.min(answer, f(R, U));
    

    To actually compute f, I also isolated the part that's different based on L/R/D/U into move(positive, negative) and stay(positive, negative), which map the points onto a coordinate that stays fixed & a coordinate that moves in the pos/neg direction (I basically use the coordinates $$$x$$$, $$$y$$$, $$$x+y$$$, $$$x-y$$$ appropriately).

    How I actually compute f

    Link to my submission: https://atcoder.jp/contests/m-solutions2020/submissions/15452216

  • »
    »
    6 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +52 Проголосовать: не нравится

    Definitely there is. We can repeat rotating plane by 90 degree 4 times!
    This idea made us publish this problem to AtCoder.

»
6 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Is problem E a bit-mask dp problem?

»
6 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Can someone help me optimize this dp (task D)?

https://atcoder.jp/contests/m-solutions2020/submissions/15446834

j is the jth day, p is the current money and s is the number of stocks? Since the constraints were low i thought this would pass. :(

»
6 лет назад, скрыть # |
 
Проголосовать: нравится +10 Проголосовать: не нравится

Rank12! It's the highest rank I've ever had.

»
6 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I felt E and F were tougher today than usual. I understood F could be done, by checking out the points of intersection for the lines, but that would make it O(n*n), and, the constraints would result in TLE. Google told me about some Sweep Line approach that would do this in O(n*logn), any ideas about how we could do this, or is this approach wrong altogether?

»
6 лет назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

Can anyone spot a mistake in this submission for C? https://atcoder.jp/contests/m-solutions2020/submissions/15433972 I got completely demotivated by screwing this one up :(

»
6 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится +3 Проголосовать: не нравится

Is there going to be an editorial in English? Nevertheless, can someone share their approach to solving E?

»
6 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

In question C , i use sliding window to calculate grade, I want to know that will it cause me overflow. I was using long long. I was getting wrong answer but i think it will remain in bounds.

»
6 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится +80 Проголосовать: не нравится

Hello from Japan, I am the writer of this contest.
First of all, thank you for your participation, and if you like some of our problems, I will be glad.

Anyway, this time, we gathered the problems which are educational, which are based on algorithms and implementation techniques that may need if you want to get high performances in ARC/AGC.

Competitive programming is not only thinking but also implementation. Especially in problem F, you may come up with the solution easily. But, if you doesn't choose appropriate implementation way, the code length will be much longer than the writer's solution.

In addition, we made practical and social-issue-based problems — For problem D, this problem can be used in stock market. For problem E, this problem can be used in city planning. For problem F, this problem can be used in airlines.

Again, I am very glad to see you in the standings. Thank you :)

»
6 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

hi, chokudai, i got only one WA at testcase 01-corner-05.txt of problem E, is it possible that i could obtain this testcase for debugging?

»
6 лет назад, скрыть # |
 
Проголосовать: нравится +5 Проголосовать: не нравится

Please add the english editorial for this contest on the atcoder website ASAP. Please !

»
6 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

chokudai: When will the test data be available?

I'm trying to solve E in $$$O(3^N N)$$$ but I'm getting WA on test 01-corner-03.txt only, even my stress testing failed to detect a case.

UPD: I was able to fix the bug and got AC code.

My idea is to get permutations representing the sorted points (both by X and Y) then try all the possible $$$3^N$$$ combinations (0 no line, 1 horizontal line, 2 vertical line), then for each combination (i.e. "0021022101") for each 0 we calculate the distance to the nearest 1 and 2, and since that we know the order in both X, Y we can do this in a linear time, so the overall complexity is $$$O(3^N N)$$$.

Thanks for the strong tests!

»
6 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

The official editorial is finally published in English!

In fact, the translation has completed in August 25th, and I am sorry for the late announce. Since we wrote a 16-page Japanese editorial (2x longer than usual), I guess that the translation was a long work.