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

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

Can anyone help me understand it?

I've had nightmares solving problems on this, can anyone tell me resources to study this?

Also is it really this important to learn to get to pupil ?

Thanks

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

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

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

Problem: Given an input string s and a pattern p, implement regular expression matching with support for '.' and '*' where:

'.' Matches any single character.​​​​

'*' Matches zero or more of the preceding element.

The matching should cover the entire input string (not partial).

Can anyone help me with this ?

i tried two pointers and it failed, then I looked at the solution. It was DP but I could not get the idea on how to think and understand that, Can anyone explain in easiest words to me please ?

Thanks

Spoiler

gholyo attractors 1.618034 123gjweq2

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

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

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

Given two numbers represented as strings a and b, compute their product and output product as a string.

|a| <=1e6, |b|<=1e6

How do I solve it, I brute forced it and it gives me TLE.

can anyone help me? is there an optimal way ??

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

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

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

My rating is 842, My lifetime goal is to get to pupil before I die.

4000 is something I can not even imagine, If I ever see someone with 4000 rating, i will ascend to the heavens immediately.

Thanks for reading my pain.

EDIT: My rating is now 743 after the contest (-99), seems like I will never reach pupil.

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

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

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

Its showing -84, but it was a testing round so shouldnt it be unrated for everyone ?

I dont want to lose my precious rating, Please help is this a bug ?

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

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

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

How to unfriend the user who was my friend earlier and now is disabled.

I dont wanna see such people in my friend list, How can I remove them.

Thanks for any help, greatly appreciated.

UPD: stop upvoting my blog, just answer my query MikeMirzayanov

UPD: Thanks to golden_ratio/1.618034 tourist_fantasy for helping me stop the haunting.

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

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

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

We generate permutation of given array randomly until we get it sorted.

It's expected complexity should be factorial n for n sized array, but I saw on google it's factorial n+1.

Can anyone explain to me how is it factorial n+1, because for a binomial distribution E(x) = 1/p(x).

Please purify my understanding.

Also is there any sorting algorithm better than bogosort ?

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

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

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

I joined codeforces on 16th May and it's 16th August today, It has been 3 months and I have no progress. I am still 3 digit rated. After giving every contest I am still not improving.

Is it really not for me ? Am I really 69 IQ ?

I bet no one in this world would get as little progress as mine if they practiced this hard.

Also the number of cheaters have risen significantly, impacting newbies like me.

Even after rollback I got no positive delta, It's disheartening.

With that I believe I will have to quit codeforces forever.

Goodbye, may'24 — august'24 cp journey

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

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

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

I checked submissions of the cheaters I caught and seeing them all 100% skipped made me very happy.

They get what they deserve.

Waiting for the rollback.

Good work MikeMirzayanov

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

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

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

nginx forbidden 403

Why do I get this alot nowadays when I open codeforces.com in my laptop ?

When I open it on my PC I don't get it.

What is wrong ? does anyone has any clue ?

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

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

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

Rating changes for last rounds are temporarily rolled back. They will be returned soon.

Why did they takeaway those rating points ? Can anyone explain to me ? What did I do wrong and why did they took my rating points to do some investigation upon me ?

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

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

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

2004E - Это не задача про ним

My code snippet

Whats wrong, its giving WA on testcase 3, 140th value differs found BOB correct Alice.

I'm struggling for 10 hours with this

UPD: haha what a funny bug. Thanks to WhisperingWillow

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

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

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

Hello everyone, I don't know what a Educational Codeforces Round 169 (Rated for Div. 2) is. Is there anything particularly more educational about it.

Do you need to be more educated to give the round or what ?

WHY JUST WHY?

PS: Seeing cheaters getting actually banned makes me so happy!

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

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

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

2000F - Закрась строки и столбцы

Greedy: First we find which dimension is the smallest say it's x (and it's partner dimension is y), we keep colouring x until x=y-1, now we can colour y-1 twice for y-1 cost each and we will have (x-1,x) as resulting dimension. We keep doing it until we get to say (0,1) which means we have one row/column coloured for no extra cost!

We can implement this strategy by using some visited array to keep marking indices etc. I have done the implementation but it's failing on some random testcase. I can't even dry run why is it not working. Can anyone help me with it by providing a testcase where greedy fails and why DP is the way to go.

Tagging my fav ppl (if you're free, please respond)

Fav. LGM neal. (sorry, tourist doesn't count)

Fav. IGM Shayan

Fav. IM aryanc403

Fav. CM stefdasca

Fav. Expert jatrophalouvre

Thanks for your time for reading it.

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

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

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

Why Edu Round Delta has not been updated yet?

Also, When I'm trying to submit my code, it says it's in queue.(It's been so long)

Does anyone know when will it get fixed ?

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

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

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

As a newbie, I want expert opinions on who is the best explainer of contest problems on youtube.

Is it aryanc403 or Shayan or someone else.

Thanks

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

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

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

I've been wondering for soo long about this. Some people get -ve delta after skipped contest while some get " — " (unrated) shown in their contests list. Why is that so ?

Thanks!

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

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

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

Why is this happening, please i have been stuck on this for a day now. I've searched everywhere. This is the problem DP problem -> Palindrome partitioning

I couldn't solve it and looking at solutions i couldn't understand why some solution pass and some do not, Please help me with it. I want to understand why iterative gives TLE and recursive solution passes.

Thanks.

Iterative code ->

class Solution {
public:
    int minCut(string s) {
        int n = s.size();
        vector<vector<int>>dp(n,vector<int>(n));
        vector<vector<int>>ck(n,vector<int>(n));
        for(int i=0;i<n;i++) ck[i][i]=1;
        for(int i=n-1;i>=0;i--){
            for(int j=i+1;j<n;j++) {
                if(j-i==1&&s[i]==s[j]) ck[i][j]=1;
                else ck[i][j]=ck[i+1][j-1]&&(s[i]==s[j]);
            }
        }
        for(int i=0;i<n;i++){
            for(int j=0;j<n;j++) {
                if(ck[i][j]||(i==j)) dp[i][j] = 0;
                else dp[i][j] = j-i;
            }
        }
        for(int i=n-1;i>=0;i--){
            for(int j=i+1;j<n;j++){
                if(ck[i][j]) {
                    dp[i][j]=0;
                    continue;
                }
                for(int k=i;k<j;k++){
                    if(ck[i][k]) dp[i][j]=min(dp[i][j],1+dp[k+1][j]);
                }
            }
        }
        return dp[0][n-1];
    }
};

This code doesn't work fine and gives TLE.

class Solution {
public:
    int solve(string &s,vector<vector<int>>&dp,vector<vector<int>>&ck,int i, int j){
        int n = s.size();
        if(i>=j) return 0;
        if(dp[i][j]!=-1) return dp[i][j];
        if(ck[i][j]) return dp[i][j] = 0;
        int val = j-i;
        for(int k=i;k<=j;k++){
            if(ck[i][k]) val = min(val,1+solve(s,dp,ck,k+1,j));
        }
        return dp[i][j] = val;
    }
    int minCut(string s) {
        int n = s.size();
        vector<vector<int>>dp(n,vector<int>(n,-1));
        vector<vector<int>>ck(n,vector<int>(n));
        for(int i=0;i<n;i++) ck[i][i]=1;
        for(int i=n-1;i>=0;i--){
            for(int j=i+1;j<n;j++) {
                if(j-i==1&&s[i]==s[j]) ck[i][j]=1;
                else ck[i][j]=ck[i+1][j-1]&&(s[i]==s[j]);
            }
        }
        return solve(s,dp,ck,0,n-1);
    }
};

This code works fine and beats 90% of users on leetcode.

why is this happening, please i have been stuck on this for a day now. I've searched everywhere.

Thanks!

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

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

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

I recently started doing 800 rated problems.

How do I improve when I can't solve? GCD,LCM, etc Math seems too hard.

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

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

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

When was last plag check and when should be the next ?

I have no idea when they do it, can anyone tell me ?

Thanks!

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

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

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

Hello, I have no friends irl and that's why my friend's standing page in contests is filled with tourist and me only.

Anyone who is willing to be my friend please let me know, I will add you back and we can talk a little when i'm in trouble.

Thanks alot!

PS: Don't hate on this newbie. PS: Good luck everyone for tomorrow's Div.2

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

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

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

I can't stand the wait of ~ 1 week for the contests. Why there are so few contests like this month only has 4??

Last one was on 30th June, and now on 7th july then 15th July :( . I can't just keep practicing for 7 days straight I need something to practice and test upon. No, i can't keep on giving virtuals either. I have to go back to college from 25th July and I won't be able to dp cp after that. Im tired of doing leetcode only.

MikeMirzayanov It's a humble request. @every_LGM_IGM_GM_M_CM

TLDR: Please make more contests.

THANKS!

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

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

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

I can't understand why this solution 268341805 is passing but this 268341778 is giving WA on testcase 2, both codes are 99% same.

TLDR: I am writing down the part of my code which I changed so that my code got AC.

Please all the help would be greatly appreciated. Thank you so much in advance.

auto it = upper_bound(v.begin(),v.end(),val);
                        if(it!=v.end()&&it!=v.begin()) {
                            ans=min(ans,min(abs(*(it)-val),abs(*(--it)-val))); // old
                        }
                        else if(it==v.end()) {
                            ans = min(ans,abs(*(--it)-val));  //old
                        }
                        else if(it==v.begin()) {
                            ans=min(ans,abs(*(it) - val));  //old
                        }
auto it = upper_bound(v.begin(),v.end(),val);
                        if(it!=v.end()&&it!=v.begin()) {
                            auto it2 = it; it--;                                   // new
                            ans=min(ans,min(abs(*it2-val),abs(*(it)-val)));
                        }
                        else if(it==v.end()) {
                            it--;
                            ans = min(ans,abs(*(it)-val));                        // new
                        }
                        else if(it==v.begin()) {
                            ans=min(ans,abs(*it - val));                         // new
                        }

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

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

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

What did I do to deserve so many downvotes on each and every thing I have posted comments, blogs, etc.

When i ask questions -> I get downvoted. I ask for tips -> I get downvoted.

I checked, I'm the 35th lowest rated with -62 on the whole platform. :(((

Please STOP this ratism.

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

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

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

I solved it as if y<0 and abs(y) >= abs(x) cout<<"NO"<<endl;

But this did not work even after trying so long.

why is this incorrect can anyone help this newbie?

THANKS!

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

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