Comments

I really couldn't understand what do you mean by So, for implementation details, we will think of it as if for every node U we have to find the node V with the least discovery time that can be reached from U following some DFS traversal path which does not require to pass through any already visited nodes, and let's call this node low.?

To be specific, I didn't understand the meaning of low?

Pardon me again. But I don't understand why are we not checking for n= 4, 5 ...?

Thanks, Bhai. Understood it on the second go. Hail bicsi!!

Pardon me. Let n be the number of elements in the required array.

For:

  1. n= 2: we use a+b = a⊕b + 2∗(a&b) to find a and b.

  2. n= 3: u, (v-u)/2, (v-u)/2 is the answer if v-u is even.

Suppose both the above case fails, then why are we not checking for n= 4, 5, 6... ?

Got it. This is in case of two numbers.

Why cannot it have more than 3 elements in the array?

I understood the equation but I couldn't understand the proof and sorry your statement doesn't contain a proof.

Hey, Can you please answer my following questions?

  1. If v-u is odd, why isn't there any solution?
  2. If (u & (v-u)/2) ==0, how are we sure of two numbers to be u + (v-u)/2 and (v-u)/2?

I have a hard time understanding bit operators. Thanks

I still can't get it. Can you please show us the diagram? Thanks

Please Help me understand D and E problem.

0

I had a similar idea. But I cannot convince myself that this approach works. Can you please help me?

After forming the components, I didn't understand the DSU part.

Could you please explain the Two flowers solutions, didn't understand from the editorial? Thanks

dist= sqrt( (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) )

Unit vector from (x2,y2) to (x1,y1)

along x: ( x1-x2 )/dist

along y: ( y1-y2 )/dist

also radius r= ( R + dist )/2

so coordinates of center x= x2 + ( ( x1-x2 )/dist )*r

y= y2 + ( ( y1-y2 )/dist )*r

Right? We don't need to check other direction because we are moving in the direction of a unit vector and can guarantee that it to be the farthest from circle boundary?

I cannot understand what you did after storing the indices of gym for each pokemon?

Could not even understand problem C?

Not the time complexity but the explanation of solution.

How?

Sorry but cant stop laugh! In India, your comment means "fu**ing boy" in Hindi.

Meanwhile, Can you give a hint for D?

That was not expected. Thanks.

Can anyone tell what wrong am I doing here Solution

The comment removed because of Codeforces rules violation

Could not understand the logic of D ?

On LewinCodeforces Round #385 Editorial, 10 years ago
0

Did I get it right?

Suppose there are 3 cc's of a graph. Each time I run dfs on each component, sum is initialized to zero.

for( int i= 0; i< V; ++i ){
   if( !visited[i] ){
      sum= 0;
      dfs( i );
      // num sum/2 is the number of edges in the this graph component
   }
} 
On LewinCodeforces Round #385 Editorial, 10 years ago
0

Then I will have to use extra memory to store vertices of each component, and then sum the indegrees. Will it not be too costly?

On LewinCodeforces Round #385 Editorial, 10 years ago
0

How do we count the number of edges in a graph component? Is there any optimal way ?

How do I get the idea of using topological sort for dp?

Can anyone explain D anymore better? Thanks

On vovuhCodeforces Round #374 (Div. 2), 10 years ago
0

587.

On vovuhCodeforces Round #374 (Div. 2), 10 years ago
0

May I know why ?

Couldn't understand dp solution of C? Can anyone explain with code?

Could not understand dp solution for C. Can you explain it more clearly with code? ADJA

What is wrong with my solution for Div2B ? Solution

Then s(x) < INF, right?

Thanks a lot.

How do I solve Quasi binary using dp ? I solved it in O(n), but i want to learn dp.

This was a great solution. Can you tell me how did you get the idea?

Can someone explain me, how to do Div 2A using DP? I cannot get the idea.

First you choose 1st 3, then 4 will be deleted and score will be 3. And then 3, 5, 5 can be picked without deleting any other number, hence total score of 16.

On arsijoCodeforces Round #371, 10 years ago
0

It took me only 10 mins to register for the contest this time.

+10

I would but there is a similar problem in a live running contest, where I have to make range updates to a similar problem. I think i should discuss after the contest ends.

0

How do I optimize solution to such problems then? It will TLE for range updates ( no lazy ) for N <= 10^6.

0

Is lazy propagation always applicable for a segment tree problem ? Suppose we have to find the lcm of a given range, and there are range update operation of adding a number to the range. Is Lazy propagation applicable here?

-11

Is lazy propagation always applicable for a segment tree problem ? Suppose we have to find the lcm of a given range, and there are range update operation of adding a number to the range. Is Lazy propagation applicable here?

Anyone solved D using segment tree because I have no idea about Fenwick tree?

+51

Problem statement is not very clear. :( Also the website is so slow.

Thank you. You are the best teacher.

Thanks for the explanation but i couldn't understand the login used inside for loop for N machines to calculate n0, n1; Thanks;

On M.MahdiCodeforces Round #360, 10 years ago
0

Shit! That was easy . Thank you

On M.MahdiCodeforces Round #360, 10 years ago
0

11th. I took care of connected components as well :(

On M.MahdiCodeforces Round #360, 10 years ago
0

I took care of more than one connected components but my solution gave WA for pretest 11 18806227 . I have no idea why?

On M.MahdiCodeforces Round #360, 10 years ago
+15

There is a reason why they are Red.

On M.MahdiCodeforces Round #360, 10 years ago
0

Can anyone please check my solution for Div2C 18806227 ? Thank you.

On M.MahdiCodeforces Round #360, 10 years ago
+52

Pari is a Hindi word for 'fairy'/'angel' in English.

On Huyum_nikCODEFORCES IS HOMOPHOBIC!!!, 10 years ago
-23

Why can't I learn new stuffs while practicing for A-C ? By the way, I was trying to solve this problem https://www.codechef.com/JUNE16/problems/CHSQARR of Codechef's June16 Long challenge. I thought 2D segment trees might help. I am still stuck at this. It would be appreciated if you would help. :D

On Huyum_nikCODEFORCES IS HOMOPHOBIC!!!, 10 years ago
+43

Last week I wrote a blog on how to begin with 2D segment trees. It was downvoted and were given lots of negative comments. I don't understand why so many upvotes for this post. My blog would have at least helped the beginners. -_-

On .31Codeforces Round #357 (Div. 2), 10 years ago
0

What can I do to optimize this solution. It gives TLE 18488801 in Div2C.

On .31Codeforces Round #357 (Div. 2), 10 years ago
0

a= 0; b= 17; c= 808672. Sorry earlier I wrote 1234*808672= 997901248

On .31Codeforces Round #357 (Div. 2), 10 years ago
0

Got WA. :(

On suraj021Beginning 2D Segment trees?, 10 years ago
+3

Thanks a lot mate . The google translate screwed that up.

On suraj021Beginning 2D Segment trees?, 10 years ago
0

But my ratting should not stop me from learning new algorithms. BTW I do know about 1D segment trees but 2D scares me...

Thanks

On suraj021Beginning 2D Segment trees?, 10 years ago
+3

Oh wow. You are so smart. Don't you think that I have already done that. And after failing to understand from quora, other 2D segment tree blogs in cf, I decided to write a new blog. Instead of sarcasm, why don't you teach me? :D

Btw thanks.

On suraj021Beginning 2D Segment trees?, 10 years ago
0

Auto comment: topic has been updated by suraj021 (previous revision, new revision, compare).

That much dedication.... therefore you are in Div1:)

Good luck :)

On suraj021BITMASKS — FOR BEGINNERS, 10 years ago
0

Look, you have an option of ignoring the post. Just do it. By the way JAYPEE found it useful. I helped a person. :P

Can you please explain where did I mess up?

Here it is in ideone Solution . Thank You

Can anyone tell why did I get MLE verdict on my solution of Div2B 17492812 ?

Initially You are at position 1. At 1 the direction is '>' and jump length is 2 therefore new position is 1+2= 3. At 3, the direction is '<' and jump length is 1, so the new position is 3-1= 2. At 2, the direction is '>' and jump length is '1', therefore the new position is 2+1= 3 and so on...

I got MLE in my 17492812 . Can you debug it?

On suraj021BITMASKS — FOR BEGINNERS, 10 years ago
0

Just google "Competitive Programming 3". Best of Luck

On NickolasApril Fools Day Contest 2016, 10 years ago
0

Sharing is Caring.

Can you please prove this solution?

Proof for Div2.C please? And the procedure to count no. of set bits in S is not clear to me. Please help.

On EdvardCodeforces Round #325, 11 years ago
0

Can anyone help me debugging my [submission:13576753]solution for Div2 C?

On EdvardCodeforces Round #325, 11 years ago
0

Someone hacked my solution with this test, but when I ran this program in my PC it gave correct answer. Strange but true.

On VladikCodeforces Round #321 (Div. 2), 11 years ago
0

Me too. :(

On VladikCodeforces Round #321 (Div. 2), 11 years ago
0

Oh got it TLE. :(

On VladikCodeforces Round #321 (Div. 2), 11 years ago
0

Can anyone explain me why this 13153912 got hacked?

On VladikCodeforces Round #321 (Div. 2), 11 years ago
0

I had WA on pretest 8.

Math Math Everywhere !!

0

Why can't we apply pigeonhole if n<=m ?

0

And why only first 10^4 ?

0

Can you please explain Div2 C a bit more clearly?

Apart from CP, I crawl slowly(really slowly) through the Mechanical Engineering syllabus, trying not to get a backlog. And I am not successful there.

I would to thank the Codechef's team to help me learn HTTP status codes like 1. HTTP 500 : Internal Server Error 2 .HTTP 502: Bad Gateway 3. HTTP 503: Service Unavailable 4. HTTP 504: Gateway Timeout Thank you seriously :)

On L_HProblem C Div 2, 11 years ago
0

Can you please explain your logic?

On L_HProblem C Div 2, 11 years ago
0

I tried doing it using trie but i cannot figure out the search procedure. Can you help me?

Can you please explain your check() function?

0

Have a look at this comment. Comment Here...

+1

Great, thanks, so simple :) AC 12522984

0

Problem C Div2:"Then we can calculate prefix sums (π(n) and rub(n)) and find the answer using linear search." What is Prefix sums in the statement?

On vovuhEditorial Codeforces Round #Pi, 11 years ago
0

Can anyone please explain more clearly using an example simultaneously ?

I think its like finding LCA of the nodes in the array. But unfortunately I don't know how to find LCA? Can you give me some source?

On vovuhCodeforces Round #Pi (Div. 2), 11 years ago
-26

His name is P1kachu similar to Pikachu. First two words are Pi, this may be the reason

Thanks for the reply :) I have a doubt. Won't above assumptions fail if we have suppose 3 connected components and 1st is bipartite 2nd is not bipartite and third is a simple cycle?

How do we know that we need edges 1/2/3/0 ? Please see this , i could solve only for the no. of ways( hope it is correct ).

use this to print: cout << fixed << setprecision(10) << double_value << endl;

On suraj021WA in TimusOJ, 11 years ago
0

This problem is nice. Whenever you solve it please update me :) Thank you.