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

Автор atcoder_official, история, 9 месяцев назад, По-английски

We will hold AtCoder Beginner Contest 439.

We are looking forward to your participation!

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

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

Hi, that will be my first contest. Anyway, good luck everyone.

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

hahaha!

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

Good luck!

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

Gave the contest. It was good. When and where can I find the editorial for this contest ?

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

What a big difficult gap between F and G.

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

I solved 5 problems. Got confused on problem E for a long time...

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

is E sweep line ?

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

Happy New Year! And it's a great contest as a gift for 2026, because A~F are very easy and G is challenging for advanced contestants.

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

Great contest! I solved 5 problems.(A — E)

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

got 3 WAs on B because I forgot that YES is not Yes ;((

I really have to start getting more used to early morning programming...

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

E was such a pain, I recognised LIS — knew had to handle consecutive same elements somehow.

I only tried with sorting in increasing a and then increasing b.

Editorial shows answer breaking ties by decreasing b?

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

In case anyone got 5 wa in E (Kite) like me, consider following testcase: 5 1 1 2 2 3 1 3 2 3 3 expected ans: 3 and not 2.

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

If we have an array $$$P_0, P_1, P_2, \dots, P_N$$$, how to compute $$$\sum_{t=1}^{N}(1 - P_t)^{i - 1} \cdot P_t \cdot (1 - P_{t - 1})^{L - i}$$$ for each $$$i$$$ from $$$1$$$ to $$$L$$$ fast?

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

    Change the loops. Instead of looping over $$$t$$$ (The number of turns) by fixing the $$$i$$$-th player, fix the turn and loop over $$$i$$$. Then it turns into a geometric series.

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

      I want the value of that summation for each $$$i$$$ separately not the sum of it over all $$$i$$$.

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

        Sorry I wasn't clear enough. It turns into a geometric series and we can use a generating function to solve it.

        Group the terms depending on $$$i$$$ as $$$B_t$$$ and the terms independent of it as $$$A_t$$$. Now the loop is $$$\sum_{t=1}^N A_tB_t^i$$$. Now make a polynomial $$$\sum_{t=1}^N A_t(B_tx)^i$$$ by summing for each $$$i$$$. The closed form of this polynomial is $$$\sum_{t=1}^N \frac{A_t}{1-B_tx}$$$. This is a sum of rational polynomials that can be added by DnC. The answer for person $$$i$$$ is the coeffecient of $$$x^i$$$.

        (Btw for G, in this sum we actually don't want $$$(1-P_t)^{i-1}$$$ which means (presumably) the probability that the first $$$i-1$$$ people didn't win in the $$$t$$$-th turn. We actually want the probability that the first $$$i-1$$$ people didn't win in ANY OF the first $$$1,2,\cdots t$$$ turns. Similar in the term for the last $$$L-i$$$ people. So we need to use the prefix sum of the probabilities in these two parts)

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

This is what G made me think:

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

why getting wrong answer on 3rd

int t=1;
    while (t--) {
        int n;
        cin >> n;
        int i=1;
        vector<int>ans;
        int cnt=0;
        for(int i=1;i*i*1ll<=n;i++){
            for(int j=i+1;((i*i*1ll+j*j*1ll)*1ll)<=n;j++){
                ans.push_back((i*i*1ll+j*j*1ll)*1ll);
            }
        }
        sort(ans.begin(),ans.end());
        // cout<<ans.size()<<endl;
        // help(ans);
    }
»
9 месяцев назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

I solved E but my solution was surprisingly complex for E. Segment tree + input compression + sweep. I read that some people solved it with LIS. Do you mean actually reducing the problem to LIS or did you implemented a similar solution to LIS but maintaining best sequences for 2 types. Those that ends on a segment directed in bottom-right and those directed to top-right?

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

gl & hf!