wakanda-forever's blog

By wakanda-forever, 2 months ago, In English

Thanks for participating. I apologize for the unexpectedly hard B. Apart from that, I hope you liked the problems and enjoyed the round!

I would like to thank Proof_by_QED, Forge, and awesomeguy856 for pointing out an elegant $$$\mathcal{O}(n)$$$ solution for problem G.

I would also like to thank temporary1 for helping me write the editorial for problem F and Forge and reirugan for proofreading the editorial.

Rating predictions

2241A - Divide and Conquer

Idea
Implementation
Rate The Problem!

2241B - Good times Good times

Idea
Implementation
Rate The Problem!

2241C - RemovevomeR

Idea
Implementation
Rate The Problem!

2241D - An Alternative Way

Idea
An Alternative Way
Implementation
Rate The Problem!

2241E - Fair and Square

Idea
Implementation
Rate The Problem!

2241F - A Bit Odd

Idea
Implementation
Rate The Problem!

2241G - Summmon

Idea
Implementation
Rate The Problem!
  • Vote: I like it
  • +98
  • Vote: I do not like it

»
2 months ago, hide # |
 
Vote: I like it +83 Vote: I do not like it

very bad at game problems what to do?

Spoiler
»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Thanks for this beautiful round and amazing problems :)

»
2 months ago, hide # |
 
Vote: I like it +5 Vote: I do not like it

Problem E is very elegant

  • »
    »
    2 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    can u Please explain me problem E

    • »
      »
      »
      2 months ago, hide # ^ |
      Rev. 2  
      Vote: I like it 0 Vote: I do not like it

      Sure man.

      Part 1: What makes a triplet good?
      Part 2: How to count good triplets?
»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Problem B was even harder than problem D. Finding the idea that you have to multiply x by 10...01 was crazy difficult. Great contest!

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Hello guys,

I've solved many standard DSA problems, but I'm struggling with problems that require identifying patterns.

Even when I solve a Codeforces problem, my solution usually looks much messier compared to other people's solutions. I'd really appreciate some guidance.

Do you guys have any set of problems or resources that can help me improve my pattern recognition? I'm ready to work super hard, but I don't have proper guidance or know which resources to follow.

Any advice would be greatly appreciated. Thank you!

»
2 months ago, hide # |
 
Vote: I like it +5 Vote: I do not like it

One of the greatest contest I have ever seen.

Hats off to the writer .

Great efforts...

»
2 months ago, hide # |
 
Vote: I like it +2 Vote: I do not like it

Not me getting absolutely demolished by B today, man I suck at these type of problems so bad, I found C and D easier than B. Though the contest had pretty good questions in my opinion.

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

A<C<D<B I thought time limit per test meant time limit for each small test in a pretest/test so i spent a whole hour trying to bruteforce B lol, goodbye pupil

»
2 months ago, hide # |
 
Vote: I like it +18 Vote: I do not like it

F < E

»
2 months ago, hide # |
 
Vote: I like it +31 Vote: I do not like it

In G theoretical maximum is 2e5*(2e5-1)/2*1e9, it's okay for ull, but bad for ll. I have test for that, and hacks now are incorrect.

  • »
    »
    2 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    A little bit correction: The maximum answer for each range is $$$5 * 10^{8}$$$, so theoretical maximum answer for this problem here is actually $$$10^{19}$$$ instead of $$$2 * 10^{19}$$$. Still we would need an unsigned 64-bit integer.

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Thanks for this beautiful round and problems ! It was very fun

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

It was so interesting and brainstorming

»
2 months ago, hide # |
Rev. 2  
Vote: I like it +7 Vote: I do not like it

Chronology.

1) Solved A.

2) Read B, tried around 8-10 minutes, couldn't find any pattern. Wrote two for-loops and isGood(x) to brute the solution. Skipped cos couldn't find pattern from Brute.

3) Read C, solved.

4) Went back to B, read again. Couldn't find pattern again. (Spent around 2 minutes ).

5) Read D, solved it.

6) Went back to B AGAIN. still couldn't find pattern. ( spent more than 5 minutes, because I thought "so many people solved B, so it must be simple!!"). Again wasted those 5 minutes.

7) Read E ,solved it.

8) Again went back to B, (This time, again spent 5-7 minutes, and still coudn't solve it ).

9) Read F, solved it with two attempts.

10) Tried B AGAIN. Couldn't solve it AGAIN.

11) Read G, and realised so less accepted solutions for G. So moved back to B.

12) Finally wrote full fledge brute() for B. and found pattern when printed all possible good numbers for 'x' where (100 <= x <= 1000). ( Found common number 1001. found pattern ).

Honestly, If we know B, its easy. But if we don't , bruting our way through pattern is difficult :( .

  • »
    »
    2 months ago, hide # ^ |
     
    Vote: I like it +2 Vote: I do not like it

    B was the real final boss of the contest.

  • »
    »
    2 months ago, hide # ^ |
     
    Vote: I like it +1 Vote: I do not like it

    What do you mean, only took me 5 minutes to get B. But yes, I'm learning from your strat of printing the answers via brute force. But stood absolutely no chance against E or F.

  • »
    »
    2 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    LOL, i just figured it out in like 3 minutes :D ($$$1 \leq x \lt 10^8$$$ not $$$\le 10^8$$$ saved me when it was queuing)

  • »
    »
    2 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    Can you share the code and how you found pattern for problem B using bruteforce?

    I also tried printing using bruteforce but can't find any pattern using it.

    My code:

        #include <bits/stdc++.h>
        using namespace std;
        
        bool isGood(int n){
            unordered_set<int> digits;
            while(n > 0){
                digits.insert(n % 10);
                n /= 10;
            }
            
            return digits.size() <= 2;
        }
        int main()
        {
                for(int x = 1; x <= 100; x++){
                    cout<<"VALUE: "<<x<<endl;
                    if(isGood(x)){
                        for(long long y = 2; y <=  10000; y++){
                            if(isGood(y) && isGood(1LL * x * y))
                            {
                                cout<<y<<" ";
                            }
                        }
                        cout<<endl;
                    }
                
             }
            return 0;
        }
    
»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

idk why but problem B seemed to be the easiest for me even tho i only managed to solve A , i read problem D and immediatly skipped it when i saw the graph , but good contest so far(it may be my best) .

Any tips for improvement ?

»
2 months ago, hide # |
 
Vote: I like it +24 Vote: I do not like it

Problem G solution is wrong, Answer exceeds the long long range.380842381

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Me overcomplicating 2241B - Good times Good times while 10^digits + 1 was patiently waiting in the corner

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Got A-D in 40 mins and basically finished the contest. I negged on D three times because I'm a noob, I wrote a[0] = b[0], but in reality all cases where a[0] <= b[0] worked. Finally hitting pupil! Yay!!!

»
2 months ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

B is honestly easier if you do math contests. If you do math contests, you would know about the multiply by 101 and 1001 tricks, which would make it easier.

  • »
    »
    2 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    I could not get it in the starting. But when i write x twice and divided this number by x again then I see the pattern. Like for x = 73. My y is 7373 / 73.

»
2 months ago, hide # |
 
Vote: I like it +11 Vote: I do not like it

Problem G remember to use unsigned long long because there's a hack that can construct a answer to $$$9955440513000000000$$$(LLONG_MAX $$$9223372036854775807$$$ is lower than this).

  • »
    »
    2 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    it's crazy how in the implementation of the solution the author used long long not unsigned long long.

  • »
    »
    2 months ago, hide # ^ |
     
    Vote: I like it +3 Vote: I do not like it

    I guess that the author didn't expect it so I guess it is reasonably to say that they should have added a constraint that the answer do not exceeds LLONG_MAX as if not maybe almost all accepted solution will be hacked.

»
2 months ago, hide # |
Rev. 3  
Vote: I like it +1 Vote: I do not like it

for F Alice can win as long as there's a single element that causes odd inversions (odd 1's in front of 0 or odd 0's after 1)

  • »
    »
    2 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    Yep. This is obviously for overall even inversions.

    The proof that (for every array with even prefix counts of 1s and 0s) also follows that both parities will be same. Since Alice has to choose odd, Bob gets the game-ending odd move

  • »
    »
    2 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    please spoiler!

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Thanks for this elegant contest

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

My n^(3/2) solution to E:

Spoiler
»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

b was harder than c and d .

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Great contest. Couldn't figure out a trick for counting subtrees' sizes for the problem E, so switched to F and managed to solve it at the very last moment. The funny thing about E is it's sort of a regex problem.

»
2 months ago, hide # |
 
Vote: I like it +7 Vote: I do not like it

I'm glad so many newbies paid tribute to me by putting wf at the end of their variables ❤

Truly heartwarming ❤

»
2 months ago, hide # |
 
Vote: I like it -11 Vote: I do not like it

我还以为b题是dfs,打表才发现是找规律

»
2 months ago, hide # |
 
Vote: I like it -10 Vote: I do not like it

.

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

x < 1e8 and not <= 1e8 in B saved me big time

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Attempting a contest after long time, guys help me debug my solution for D, any help is appreciated. https://codeliveshare.com/ide/hXAw317iGb

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

why rating is not getting updated

»
2 months ago, hide # |
 
Vote: I like it +5 Vote: I do not like it

My post contest discussion stream here and hints here

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

I thought that in B x <= 1e8 (including 1e8), so I added a condition that checks if x == 1e8 then y = 2 (or any number that only has one unique digit). Afterwards found out that wasn't necessary

»
2 months ago, hide # |
Rev. 2  
Vote: I like it 0 Vote: I do not like it

cool E, learned new things. thanks a lot :)

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

The first contest that I have practiced after I came back form CP. It's tooooooooooo difficult for me.

»
2 months ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

The contest was reeeally fun but I'm kinda concerned about CodeForces not being able to catch the cheaters..

Like, many of the top 20 people were newbies until now (consistently having 8K+ ranks and not being able to cross the 1200 mark) but somehow they were able to solve all the problems soooo quickly? T^T

Ain't it kinda sus?

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

B looks very easy, but it was the scariest one

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

After sitting with the B for a solid 30 minutes, I realised the 10^d + 1 pattern. Wrote the code. Got WA on test case 2. Turns out, though my logic was correct, I made a mistake in counting the number of digits. Facepalm

Anyway, decided to input the x as string. And used the x.size() to count the digits

380764045

Very nice problem none the less

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Quickest rating update in a Div. 3! I actually clutched up!

»
2 months ago, hide # |
 
Vote: I like it +6 Vote: I do not like it

I was randomly solving this problem today and noticed it felt very similar to Problem B from this contest. It turns out they have the same author... 🦁

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

In B i tried to make preprossesing for all nums from 2 to 1e4

check is they good and push them to vector then i use this vector and loop on it to find a good y that give me good x*y

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

OMG such a nice round. too bad i missed the contest because i went to play badminton instead smh.. gotta keep an eye on the timings.

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Bruh, I literally thought of the solution for problem B, but I disregarded that as soon as it came to my mind thinking that y is 10^9 max, and 10^d will exceed that.

Man I should have given it more thought.

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Oh why I didn't think of this solution for question B?

»
2 months ago, hide # |
Rev. 2  
Vote: I like it 0 Vote: I do not like it

very nice contest.

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

how can i practice to solve these problems?i just did problem A

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

was it intentional in g to make the answer out of bound of the long long range

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

I've only managed to solve one problem. How can I improve?

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

If anyone needs a translation of http://e-maxx.ru/upload/e-maxx_algo.pdf from Russian into English, here you go https://cuty.io/emaxxalgoen.

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

why does number of G solvers decreases?...

  • »
    »
    2 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    Not sure, but I guess either cheaters being removed, or people getting hacked because the result does not fit in 64 bits.

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Can anyone Explain E in more Detail

  • »
    »
    2 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    You might find my commented solution useful: 381184874

    If that doesn't clear things up, at least mention which part you don't understand.

  • »
    »
    2 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    for any (u,v,w) there exist only 1 vertex x such x in all 3 simple path's (u,v),(u,w),(v,w). basically you can proof that p(u,v)*p(u,w)*p(v,w)=n²*x where n natural. So (u,v,w) good if x = k². So for every such an x, you need to calc amount of that triples. That's 0 if x has one son, y1*y2 if x has 2 sons, (s(y)²-s(y²))/2+(s(y)³-3s(y²)s(y)+2s(y³))/6 if x has >=3 sons, where y is arr of number of descendants of the sons, s(yⁿ) = sum(yiⁿ) for every i.

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

can anyone explain me approach of second problem?