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

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

Hello guys! Me, mallick630 and Cyber_Wizard from Competitive Programming Group, COPS IIT-BHU attempted to make video editorial for the Atcoder Beginner Contest 188.

So do check out the playlist, here is the link :https://www.youtube.com/playlist?list=PLLt4yMoVgczUrGGJk1XK6DdMlxNxtiX28

Please like, share and subscribe to the Youtube channel of COPS IITBHU. We will be posting video editorials of other upcoming contests too. We also have topic-wise concept videos in the channel.

The videos are a mix of Hindi and English

Happy Coding!!

Полный текст и комментарии »

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

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

I was solving D. Dima and Lisa and I was unable to solve the question by myself after trying for an hour. I knew about Goldbach's Conjecture so I had an idea as to how to solve the problem to some extent leaving behind to find last two primes (for n<=10^9) (after setting first one to 3 among the three primes). (For n>9)

I saw the submissions of some coders and they solved the question exactly as follows for the last two prime numbers.

//the function for prime checking

bool isPrime(int x)
{
    for(int i=2;i*i<=x;i+=1)
    {
        if(x%i==0)
        {
            return false;
        }
    }
    return true;
}
int main()
{
    int n;
    cin>>n;
    if(n==3)
    {
        cout<<1<<endl;
        cout<<3<<endl;
    }
    else if(n==5)
    {
        cout<<1<<endl;
        cout<<5<<endl;
    }
    else if(n==7)
    {
        cout<<1<<endl;
        cout<<7<<endl;
    }
    else if(n==9)
    {
        cout<<3<<endl;
        cout<<3<<" "<<3<<" "<<3<<endl;
    }
    else
    {
        cout<<3<<endl;
        cout<<3<<" ";
        for(int i=3;2*i+3<=n;i+=2)
        {
            if(isPrime(i)&&isPrime(n-3-i))
            {
                cout<<i<<" "<<n-3-i<<endl;
                break;
            }
        }
    }
    return 0;
}

The code seems to run with an worst case complexity of O(sqrt(n)*n) and in the given question n<=10^9 and still the submissions gets an AC in just 31ms. How is the break statement working and finding out the two primes? Is it because of weak testcase?

Here you go with the solution. My Submission

How is it possible? If I am wrong at finding out the complexity please help and tell how this works?

Полный текст и комментарии »

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

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

I cannot access codeforces with one of my network in any of the devices, neither laptop nor phone. It is my wifi router which is not able to access codeforces for sometime(yesterday) . I don't know why. When I use my my mobile network, it works. Like I am writing this with my mobile connection. Please can someone help me on this. Is anyone else facing same problem? Thank you.

Полный текст и комментарии »

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

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

Hello Guys!! From the start of this year,we got to know that a2oj Ladders became static and the problems you solved didnt had any changes.

But I found a site which again gives back us the Dynamic mode of a2oj Ladders..

Click here for the website

All credits to this guy -subodhk

Git repo

Stay safe guys!!

Happy coding!

Полный текст и комментарии »

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