drexdelta's blog

By drexdelta, history, 13 days ago, In English

Hi all, I have just now solved this leetcode problem in O(N^3).

I am curious if we can solve this problem in O ( N ^ 2 ) ?

For those, who are interested in understanding O ( N ^ 3 ) approach, please let me know, I will try my best to explain.

MY code for O ( N ^ 3 )

Full text and comments »

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

By drexdelta, history, 6 weeks ago, In English

I would like to share much valuable lesson I learnt today in Div2- 986 contest. I wasn't able to Solve B, and that costs me not solving C and D.

For anyone, not being able to solve an EASY problem, is more frustrating than not being able to solve HARD problem.

Chronology:

1) 2 wrong submissions in B:

Since 10 ^ 18 * 10 ^ 18 was too large, I wrote of writing code in c++, and convert it to python. Which Got TLE . First wrong submission started panic mode.

Then, I started to find O(1) solution for Problem B, and missed edge cases. Wasn't able to solve B for first 50 minutes of the contest and I couldn't control emotionally.

2) Read Problem C, found it very easy. Submitted, which failed on Pretest 2

I submitted this C, during the contest. just by changing one of <= condition to < gave me AC. I would have easily debugged this, if I would have been calm.

3) I misread D, implemented wrong, couldn't even pass pretest-1 As I have mentioned in this comment, I had missed one crucial detail in the problem D.

After the contest, I solved B,C,D all together. I figured out, that C and D I was quite close to solve. Even if I had solved C and D, and left B unsolved during the contest, I would have been satisfied with my performance.

Full text and comments »

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

By drexdelta, history, 12 months ago, In English

Hi all,

I am trying to upsolve this problem. https://mirror.codeforces.com/contest/1699/problem/E

Can someone please help me understand the first two paragraphs of the editorial ?

How to build the DP solution that is mentioned in the paragraph-2 ?

How to do it in O ( vmax * log vmax * log vmax ) ?

Thanks in advance.

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By drexdelta, history, 18 months ago, In English

I am trying to solve Problem D from CF-823(div-2).

https://mirror.codeforces.com/contest/1730/problem/D

I have written my doubts here, if anyone has time, please help me understand...

1) DOUBT 1

The editorial says,

If you reflect the second string and see what happens, it is easy to see that the elements at the same positions in both strings after any action remain at the same positions relative to each other.

What does "reflect" mean here ? does the editorial mean that reverse the second string ?

2) Doubt 2 ,

If the word reflect means reverse, then, according to the editorial,

the elements at the same positions in both strings after any action remain at the same positions relative to each other.

What does this even mean ?

Considering the below example, Suppose we have n = 8, and instead of calling S1 and S2, I am calling then string S and string T,

s1  s2  s3  s4  s5  s6  s7  s8
 |  |   |   |   |   |   |   | 
t1  t2  t3  t4  t5  t6  t7  t8

There is mapping between each one of the position and relative order initially matching with each other. 

Action 1 , K = 3
t6  t7  t7  s4  s5  s6  s7  s8
 |  |   |   |   |   |   |   | 
t1  t2  t3  t4  t5  s1  s2  s3

Action 2, K = 6

t3  t4  t5  s1  s2  s3  s7  s8
 |  |   |   |   |   |   |   | 
t1  t2  t6  t7  t7  s4  s5  s6 

Now as we can see, that t3 character and s3 character are part of the same string, now what relative order are we talking about here ?

What exactly is happening here ?

It definitely is not EASY to see , """ that the elements at the same positions in both strings after any action remain at the same positions relative to each other""" .

can someone please help me here ?

Full text and comments »

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

By drexdelta, history, 20 months ago, In English

I am on codeforces from last 6 ++ years. Today I saw very rude and inappropriate posting behaviour from one fake profile.

 idiot

PLEASE ADD FEATURE TO FLAG/REPORT a profile. If more than 100 trusted users are reporting the profile ( or if certain number of Div-1 coders are reporting the profile, it should be blocked ).

@MikeMirzayanov

This guy is spamming on codeforces for no reasons. Some idiot with sick mentality thinks its funny to do so.

Full text and comments »

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

By drexdelta, history, 21 month(s) ago, In English

we are given 4 integers, where a <= b , c <= d.

We have to find Sum of Xor of all the pairs (i,j) such that ( a <= i <= b , && c <= j <= d )


int sum = 0; for(int i=a ; i <= b; i++) { for(int j = c; j <= d ; j++) { sum += (i ^ j) } } return sum;

How to find this sum optimally ?

Full text and comments »

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

By drexdelta, history, 21 month(s) ago, In English

Hello @MikeMirzayanov ,

I feel like this is Bug and Not Intended Feature.

I had registered in div.4 contest when my ratings were above 1399 . After yesterday's contest my ratings fell below 1399. On participants page, I saw that contest is marked unrated for me ( which is wrong, It should be rated for me at my current ratings).

here, participants ratings while registration is taken in count and not current ratings.

I tried to find some portal where I can report bugs, But I couldn't find it. So I decided to post it here.

Full text and comments »

Tags bug
  • Vote: I like it
  • +29
  • Vote: I do not like it

By drexdelta, history, 23 months ago, In English

The editorial for D1 ( Easy version ) , I am facing difficulties understanding the editorial solution ...

Problem LINK : here

Note that because we guarantee that the root is a query, when we are computing the answer for any node 'v' in this DFS, we can assume that either 'v' or some vertex not in the subtree of 'v' has already been queried.

can someone elaborate little ?

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By drexdelta, history, 23 months ago, In English

Hi everyone,

I am trying to solve the problem here :

https://mirror.codeforces.com/contest/1758/problem/E

This is an editorial for the problem : https://mirror.codeforces.com/blog/entry/109438

I am having few doubts after reading the editorial. Can someone help out ?

My doubts : 1)

Using these relationships, we can create a weighted directed graph using our rows as nodes.

What is direction of the edge in graph ? What should be the weight of the edge ?

2) Obviously, no solutions exist if there are discrepancies in the graph (modℎ), no solution exists.

What is meaning of discrepancies in the graph ?

3) Now, for each connected component, if there is an assigned value in one of the rows it contains, we can determine all of the other values for that column in the connected component.

How can we have connected components in the directed graph ? Are there all nodes reachable from all the other nodes in the component ?

Can someone help me clear doubts so I can upsolve ?

Full text and comments »

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

By drexdelta, history, 7 years ago, In English

Hello everyone,

I was trying to solve 451 D question. and which turn out to be an easy question due to given constrain of distinct times for each alarm clocks (Please refer to question if you don't understand).

Now I had doubt. What if there could be repetitive values for alarm clocks timings. is it possible to solve this problem with greedy approach ?

If Yes/no , can you please provide proof method.

Thank you (GL & HF)

Full text and comments »

Tags 451
  • Vote: I like it
  • 0
  • Vote: I do not like it

By drexdelta, history, 7 years ago, In English

Hello guys,

I have created video on 2-Dimensional segment tree. Pre-requisite for this video is one-dimensional segment tree. I have tried to explain things as easy as possible.

2D segment tree video tutorial

we have attached code in description.(it's not full version in initial steps, because, we want you to try, functions that we have mentioned in code. I am sure, if you watch video 2-3 times, you will surely be able to implement 2D segment tree by yourself. )

Good Luck and Have Fun. Happy Coding.

Thanks again, gkcs

Full text and comments »

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

By drexdelta, history, 7 years ago, In English

Hello guys, This is my first Video Tutorial. I have made tutorial on 'C-question', Div-2 , Round 439.

Youtube Video

This question uses simple Combinatorics(Maths). Hope you find is useful. If anyone who has doubts, feel free to ask in comments. Looking forward to make more video tutorials in future! Cya!

Thanks to gkcs for his help and support.

Full text and comments »

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

By drexdelta, history, 7 years ago, In English

while learning from tutorial, I was able to understand first paragraph clearly. I can also see that we just need to find out elementary cycles in graph(which can be done with how to find primary cycles in undirected graph ? , an answer written by Aditya Prakash) .

Now I am not able to grasp how does gaussian method works. I have also tried to look into some solutions like, born2rule , rajat1603 , shubhamgoyal__ . all this solutions look very similar, which uses gaussian method.

so , can someone help me out with gaussian method ? what it actually does ? and when can we use it ?

Full text and comments »

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

By drexdelta, history, 8 years ago, In English

I have been trying to solve this question with MO's algorithm. but My solution was getting TLE. Please somebody share an approach, if it is possible to solve with MO's algorithm . Link to problem : http://mirror.codeforces.com/contest/588/problem/E

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it