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

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

We will hold AtCoder Beginner Contest 382.

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

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

I hope I can get a performance of 2270, then achieve 2000 in rating.

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

Hope the problems in this contest is better than last ABC.

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

Why problem G even exists??? Did author came up with it when he was drunk and on drugs???????

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

they put a 3500 level problem in the last question of "beginner" contest that <= 3 people will solve.... again.

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

how can one approach e problem

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

E is a nice problem even though it's very classical.

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

E was nice, but it for sure wasn't Python-friendly

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

In problem C, what if everyone could just eat one sushi, can we solve it in O(nlogn)?

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

The Editorial(https://atcoder.jp/contests/abc382/editorial/11487) should be $$$f_i =\frac{1}{1 - g_0}\displaystyle(1+\sum_{j = 1}^{N} f_{ \max(i - j, 0) }g_j)$$$ not $$$f_i =\frac{1}{1 - g_0}\displaystyle\sum_{j = 1}^{N} f_{ \max(i - j, 0) }g_j$$$.

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

I am confused about problem E.

I didn't consider $$$f_j$$$ transporting from itself while doing DP. But why can my code still get the right answer in some testcases(30/35)?

can anyone help answer this?

int main()
{
    cin>>n>>x;
    for(int i=1;i<=n;++i)scanf("%lf",&p[i]),p[i]/=100.0;
    g[0][0]=1;
    for(int i=1;i<=n;++i)
    {
        g[i][0]=g[i-1][0]*(1-p[i]);
        for(int j=1;j<=i;++j)
            g[i][j]=g[i-1][j-1]*p[i]+g[i-1][j]*(1-p[i]);
    }
    f[0]=0;
    for(int i=1;i<=x;++i)
    {
        f[i]=1;
        for(int j=max(0,i-n);j<i;++j)
        {
            f[i]+=f[j]*g[n][i-j];
        }
    }
    printf("%.16lf",f[x]);
    return 0;
}
»
2 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

https://atcoder.jp/contests/abc382/submissions/60347732 can anyone tell me where my code is wrong? I'd really appreciate it.

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

For problem E, I first got a solution that works as follows. We first calculate e = (p[1] + p[2] + p[3] + ... + p[n]) / 100.0, which is the expected number of rare cards that we can get from a pack. Then, we just compute x / e as the answer. But I find that this can not even pass the samples, and why this intuitively correct solution is not correct?

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

    How is this even intuitively correct

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

    This might work in theory if you could open fractional decks (e.g. spend 1/100th the regular amount, but the # of rare cards gained is divided by 100 as well), since you could spend infinitesimally small amounts to converge on the value $$$e$$$ above as the # of rares per unit deck opened. For the original problem, this won't work because if you have something like $$$X=1$$$ and $$$P=[100,100,...,100]$$$, then $$$X/e$$$ will yield a value smaller than 1, which is impossible. You instead have to consider the problem in terms of states and transitions, where your state is the number of rares $$$r$$$ owned, and a transition consists of opening $$$i$$$ rares in a deck with some probability, which transitions from $$$r$$$ to $$$\min(X, r+i)$$$.

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

Is there a guide on how to use the AtCoder library in python?

I got the right idea for F but my implementation of lazy segtree was too slow.

EDIT: I figured it out. NVM.

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

I'm not sure if I misunderstood the question due to my poor English.

But in my understanding, E ask the answer of "at least X Cards" question.

However, in the Editorial (and test data,I think),it seems to solve the "exactly X cards" question.

Because the Editorial said "we can compute f_x in a total of O(NX) time.", and I spant almost AN HOUR to debug and found that my answer of the "exactly question" is same as the the sample Input. (and I got AC of course)

I initiated a clarification but no one answer me until now.

Or maybe I actually got the answer of "at least question"? Can someone tell me ?

My code is below. I have made it concise for readability.

#include <bits/stdc++.h>
using namespace std;
const int maxn = 5050;
int n,m;
long double ans,p[maxn],f[maxn];
int main(){
	n = read(),m = read();
	p[0] = 1;
	for(int i = 1; i <= n; i ++){
		long double x = read() / 100.0L;
		for(int j = i; j >= 1; j --) p[j] = p[j] * (1 - x) + p[j - 1] * x;
		p[0] *= 1 - x;
	}
	for(int i = 1; i <= m; i ++){
		f[i] = 1;
		for(int j = 1; j <= i && j <= n; j ++){
			if(i - j >= m) continue;
			f[i] += p[j] * f[i - j];
		}
		f[i] /= 1 - p[0];
	}
	printf("%.8Lf\n",f[m]);
   return 0;
}
  • »
    »
    2 года назад, скрыть # ^ |
    ← Rev. 2  
    Проголосовать: нравится 0 Проголосовать: не нравится

    Originally, I had to calculate many additional things to tally the "at least question" answers. If I hadn't accidentally discovered that the value of $$$f[m]$$$ matched the sample, I might have never solved it. XD

    And the total time I spent on the other five questions was even less than 20 minutes. :(

  • »
    »
    2 года назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится
    function<double(ll)> recur = [&](ll i) -> double
        {
            if (i <= 0)
                return 0.0;
            if (dp1[i] != -1.0)
                return dp1[i];
            dp1[i] = 1.0;
    
            for (ll j = 1; j <= n; j++)
            {
                dp1[i] += dp[0][j] * (recur(i - j));
            }
    
           dp1[i]/=(1.0-dp[0][0]);
            return dp1[i];
        };
    
    

    This was my code, where dp[0][j] is probability to get j cards from one pack. The statement clearly mentions "atleast X cards".

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

      I think your dp1[i] means the answer of "exactly X Cards", because the transformation looks the same as mine. Did you just output recur(m)? Then the statement was wrong and misleading.

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

        No here is why, basically it stops at the moment it gets atleast X (I'm assuming this is what you mean by M) , and why it works correctly is so in a pack we can get 0 to N cards, the 0 part is handled by the divison part, for 1 to N even if we get some amount of cards such that (i-j)<0 (this handles the atleast part)

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

          I knew why I'm wrong. Because the "1.0". If I consider it as the "exactly X cards", then the "i-j<0" part would not be counted and the sum of the probability would be less than 1. Thx anyway :)

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

problem C ,why can my code get the right answer in some testcases(28/30)?https://atcoder.jp/contests/abc382/submissions/60350177

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

I need more problems like E to practice. Anyone knows where to find them?

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

Can anyone please explain how did you get the equation for "fi" in problem E?

I am unable to understand the editorial — https://atcoder.jp/contests/abc382/editorial/11487

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

can someone explain problem d time complexity??

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

I am confused of E. I don't understand why f_x can derive from f_x itself. The problem says we should open packs until there are at least x rare cards. This should also express that when we have at least x cards, we should stop. ( I'm extremely bad at probability and expectation.