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

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

We will hold AtCoder Beginner Contest 151.

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

We are looking forward to your participation!

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

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

Hope that it's rated!!

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

How to solve F?

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

Hi, alex9801. You solved F in 2 minutes and 30 seconds!

Also, I just want to say that your code was written by me! :)

submission: https://atcoder.jp/contests/abc151/submissions/9442898

github: https://github.com/koosaga/DeobureoMinkyuParty/blob/master/teamnote.tex#L1535

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

F-Enclose All seemed to be binary search on real numbers, but I could not figure out how to solve keeping both x and y co-ordinate into account. Can anyone explain his/her approach towards the problem?

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

How to solve E?

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

    you can count the contribution of each element as 1. minimum and 2. maximum.

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

    Sort all the values and calculate contribution of each element in the final sum. If the position is $$$i$$$, then contribution is $$$a[i]*(C_{k-1}^{i} - C_{k - 1}^{n-i-1})$$$

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

    It can be solved by just fixing the min and max elements and rest can be chosen arbitrarily from elements having values in between them. 1. Sort the array. 2. Calculate prefix sums. 3. After fixing the min and max elements in the array, there can be k-2 to n-2 elements in between the min and max elements. So loop over them and multiply the value with (no. of elements in between)C(k-2). Note: - C means Combination. - Keep % 1e9 + 7 into account as well.

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

    Sort the array, now notice that, you can choose all elements from k to n as the maximum number. Now if you choose i th number as the maximum, then you can take k — 1 numbers which are smaller or equal to i th number. so i th number will appear ncr(i — 1, k — 1) times as maximum.

    For minimum, we can choose numbers from 1 to n — k + 1, suppose you choose i th number as minimum, the you can take k — 1 numbers which are greater or equal to i th element. So i th number will appear ncr(n — i, k — 1) times as minimum.

    Then our answer is max_sum — min_sum

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

Why does this TLE in D. I did bfs from all the points. https://atcoder.jp/contests/abc151/submissions/9478877

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

Can someone help in telling the DFS approach to problem D? Why this is wrong

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

deleted

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

weak test cases for problem C and wrong answer in editorial

it not cover the case when WA for that question is present but contestant not submit any problem show "AC".

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

Geothermal Please make the editorial for this contest, like you always do.

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

Can someone tell me why this has WA for Problem E in a few cases? https://atcoder.jp/contests/abc151/submissions/9466294

I sum the contribution of elements that can be max, and the contribution of elements that can be min, and then subtract them in the end (S_max - S_min)

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

    Well I figured out what was wrong with it, and it turns out it could be one of those differences in compilers/configuration and handling of data types and so? In my code, I had #define mod 1000000007, when I change it to a declaration of a long long variable ll mod = 1000000007; the same exact code passes, here.

    It's weird, I've used this in many problems before without problem, so I am suspecting, something is off with AtCoder's settings, I could be wrong though. BTW, I did try declaring it as an int variable, but that doesn't pass. In either case, can anyone clarify or shed some light on this issue?

    RaunaqRoxx This looks like it's what's wrong with your code as well.

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

Here is my submission for problem D why it is getting TLE. I have seen similar soln passing

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

I will be really glad if someone can provide a test case where my submission for E is going wrong. https://atcoder.jp/contests/abc151/submissions/9484300 It's getting WA at 4/18 test cases but I cannot find any counter cases. I am doing close to what is given in the editorial.

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

I tried this gradient descent-like approach basically I check 8 directions of current point and go to the one with minimum radius (centered on that point) and break when the current point is smaller than all the 8 directions. I loop this several times with increased accuracy (double dumb). Can anyone explain why I get WA? I think its precision problem but I looped a lot of times. Any suggestions of improvements are also appreciated.

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

My Solution for problem D

Explanation : I used 2 BFS to calculate the longest path in the matrix. The first BFS (function name bfs1) gives me the coordinates of the road block farthest away from the start coordinates. The second BFS (function name bfs2) takes those coordinates (which we got from bfs1) and calculates the max distance.

More info. about this double-BFS method : Longest path in an undirected tree

Result : I passed all the test cases except for one (i.e. hand_04 test file). I don't know where I went wrong. Guys please help finding me this corner case or if my approach is wrong please let me know.

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

fpr E,why do i get WA when i calculate maxium but get accepted when I calculate minus first?

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

for E,why do i get WA when i calculate maxim but get accepted when I calculate minus first?

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

my solution Why do i get WA on C. I increment penalty for each WA for a problem untill it gets AC. Can someone please give me a sample case where it fails.