SevenAlarm's blog

By SevenAlarm, history, 2 months ago, In English

Hi :D I made this blog to ask a simple question and use your experiences, dear CF community.

I feel like Ive been stuck on Pupil for way too long... even though I participate in almost all contests and upsolve many of them. Ive got really close to Specialist but keep falling back. Can you give me some suggestions, or really anything that worked for you? Tnx

Full text and comments »

  • Vote: I like it
  • -10
  • Vote: I do not like it

By SevenAlarm, history, 4 months ago, In English

I've been stuck with this problem for a couple of days. I came up with a strange 3-dimensional dp and the constraints actually allowed it, so I coded it and ran into wrong answers (nothing new)

Now I'm noticing that if the given inputs are all their maximum (250), it will be equivalent to a 250 * 250 board and the answer is 250! which cannot be stored. But the problem statement doesn't mention any guarantee, nor does it say that I should return the answer modulo 1e9 + 7 or something like that.

I'm getting wrong answer on test 15 (it could be a problem with my solution as well) but just asking, what's up with this?

Full text and comments »

  • Vote: I like it
  • +3
  • Vote: I do not like it

By SevenAlarm, history, 4 months ago, In English

Hello to Codeforces community! I pretty much am taking this as a clickbait but Codeforces system thing just sent me a message saying that I'm apparently winning a prize from the NEAR contest. They sent me this link to connect my cf account with NEAR but when I click on the link it gives an error code 500 — Internal Server Error. I'm not quite familiar with servers and stuff so I just wanted to make sure, if you are getting a prize as well, is it like this for everyone now?

I'd be thankful if you tell me, I'm too Excited for my own good (Idek how much an NEAR is lol)

Full text and comments »

  • Vote: I like it
  • +9
  • Vote: I do not like it

By SevenAlarm, history, 4 months ago, In English

Hello cf community. I've recently grown quite eager of my rating change and honestly cant wait until the ratings update. I had heard of these Telegram Bots/Chrome extensions which make predictions of your rating change after a contest (probably based on your net ranking?) and searched them up, but non of them worked for me. Does any one know/use one? I'd be thankful if you suggest.

Full text and comments »

  • Vote: I like it
  • -1
  • Vote: I do not like it

By SevenAlarm, history, 12 months ago, In English

Hi! This is my first ever post on Codeforces XD I've solved 484A - Bits this problem and it works fine with the tastcases given in the submission details in my own compiler (I'm using vscode) but is apparently giving different outputs on Codeforces' judge. And the difference is like, off by 1!

I've attached the screenshots from 1)cf output & 2)my original output also here's my code:

#include <bits/stdc++.h>

using namespace std;
long long l, r;
long long p, ans = 0; // ans = 32

int main()
{
    int n, lg1, lg2;


    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> l >> r; // 38 , 63
        lg1 = log2(l); // 5
        lg2 = log2(r); // 5

        if (lg1 != lg2)
        {
            if (r == pow(2, lg2 + 1) - 1)
            {
                ans = pow(2, lg2 + 1) - 1;
            }
            else
            {
                ans = pow(2, lg2) - 1;
            }
        }
        else
        {
            if (r == l)
            {
                ans = l;
            }
            else
            {
                int i = lg1; // i = 5 ,
                ans = 0;
                while (lg1 == lg2)
                {
                    p = pow(2, i); // 32
                    if (l >= p)
                        ans += p;
                    l %= p;        // 6
                    r %= p;        // 31
                    lg1 = log2(l); // 2
                    lg2 = log2(r); // 4
                    i--;
                }

                if (r == pow(2, lg2 + 1) - 1)
                {
                    ans += r;
                }
                else
                {
                    ans += pow(2, lg2) - 1;
                }
            }
        }

        cout << ans << endl;
    }
}

I'm assuming there's some problem with the values being very large, since the bug happens with the 18 digit testcase lol. Could there be some memory trick that I can do? I'm relatively new to the c++ community and would be very happy to get ur tips.

Full text and comments »

  • Vote: I like it
  • +1
  • Vote: I do not like it