Comments

Can you Open the submission to view them??

On underdog.Google Interview Question, 18 months ago
0

for k <= 10 for a point (x , y) , we can iterate over all possible (x1 , y1) such that (x1-x)^2 - (y1-y)^2 <= k^2 abs(x1 - x) <= k or x-k <= x1 <= x+k y-k <= y1 <= y+k Time Complexity : n * 2k * 2k

Sort edges with weight We can use two pointer i = 0 for j = 0 .. n-1 while check(mini = W[i] , maxi = W[j]) //return if connected or not ans = min(ans , W[j] - W[i]) i++ //check function can be implemented in O(m) , like BFS // time Complexity : O(m^2 * 2)

is tshirts is uptill 2000 in round2?

+4

How to do you think then any team will come to your college if they are far from the college > 100 km


Ohk, i don't think you will able to understand it completely, possibly because you seem to not reached enough level to solve this. Let me give you an idea what is 2 sat: assume some boolean variables x1 x2 ... xk func : (kx | ky) & (kx2 | ky2) & ... ki : be any value of the variables We need to find if there is some assignment of these boolean variables such that the function evaluates to true For more: cses programmer handbook (google it, you will find the book)

I just submitted with 2-sat and it got accepted , probably you not making the graph correctly refer to my solution for checking the edges

First thing , dont ever put the soln idea or hint in the title As here "2-SAT" either put it in spoiler

Done the same thing with hashing and seg tree

Thanks for this post

i get the segmentation fault on it. Now i have increased the stack size and now its working fine

Back to back is it not possible to shift a bit like 1/2 hr agao

is it clashing with meta hacker cup

they still dont know binary search

I have a little better way to explain: 

Let say current tree has n nodes,  partition leaf edge
      so we remain with  sz1 = 1  , sz2 = n-1

if n is odd ,  n-1 operation we want = even    so if initially xor = 0
   then   0 ^ (sz1 = 1) ^ (sz1 = 1) .... even time   = 0

if n is even , we can make xor = 1 by the above rule right
     but there is a catch , if n==2  xor = 1 is indeed the answer
                            if n > 2 xor = 0 is also possible

    Let see how ->   first thing  pertiton into sz1 =1  , sz2 = n-1  is still there
                            n    -->    n-1    --->    n-2
        (sz1 , sz2) =  (1 , n-1)     (1 , n-2)       (1 , n-3)

                    0 ^   (n-1)   ^   (n-2)  ^ (rest will be the same problem)
     (n-1)^(n-2) = 1

     So if you see that we start with (n =even , xor = 0)    -> apply type1 = 1 as final
     so got to                        (n-2 = even , xor =1)  -> apply type1 = 1^starting - 0



Getting tle with the same Approach :((

Can you check it once link : https://mirror.codeforces.com/contest/2020/submission/283786350

Thanks

E can also be solved with a different approach Also. My idea is related to binary search the answer

Comment link of Solution : https://mirror.codeforces.com/blog/entry/134087?#comment-1200754


For Problem E , I think of a solution Its giving TLE so for person to meet at k , 1 -> k n -> k are two disjoint path with just one element common = k so we can binary search over it to find first path where the common element is just one logn * (nlogn)*mul -> mul is ig in my implementation is 2 or 3 which leads to TLE Accepted Version : Same idea with Binary search but reducing Complexity in Check function which i just realised when i am writing this Comment Instead of computing sets which can be visited from 1 and n again and again , just do once and count complexity : logn*n -> Accepted

Link : https://mirror.codeforces.com/contest/2014/submission/282393166

On liaoyanxucheating?, 21 month(s) ago
0

There are dsu based solution also Bro

I find it little tricky still.

.

i do it with dsu as mentioned by the above user

Hacker Move Sir!!

0

individual?

Also can you do it for other convolutions Also

xor ,or ,and many other

First time i understand what convolution is

Thanks!!

Let meet there, Big fan :)

Bro do you think of coming to iiit Allahabad? (codered)

++

is in sorted order?

Assuming diff = sum1-sum2

dp[n'][k'][diff] = max value in both of them such that by 
                   adding this to sum1 , they can be equal
Ex:  diff = 3 , dp[n'][k'][diff] =5
     means sum1 = 5 + 3 , sum2 = 5     , 5 is max possible we can make here

Ex:  diff = -3 , dp[n'][k'][diff] = 5
     means sum1 = 5 - 3 , sum2 = 5     , 5 is max possible we can make here

Transiition: (you see in above example that the value that dp store is sum2 right)
               Thats why we do b[i]
     dp[n'][k'][diff] = max(dp[n'-1][k'-1][diff] , b[i] + dp[n'-1][k'-1][diff + a[i] &mdash; b[i]])

     Now in the end, what values we get in diff , if diff > 0 , ans = max(ans , dp[n][k][diff])
                                                  else   ans = max(ans , dp[n][k][diff] - diff)

When it s uploaded to gym?

i seen the submission of the people have solved it

they use the same code for n,m 
Means it will work for n,m  also right

Now i know like , in Ax = B
         B has entries like D[i] + k1*365
So we need to do something like crt right to find the first value, then corresponding k1 k2 .. can be found

But what they doing like , 5 * 73 = 365 , 5 as p1 , 73 as p2



Did you know what they do?

Where is the editorial

There is another blog https://mirror.codeforces.com/blog/entry/68953

Here in practise problem Section ,you can find the solution of this problem with explanation

Bro did you solve the B problem I think of gausss elimination but don't know how to correct implement it

i tried the code from cp algorithm , but it is for n = m , n+1 th column for B (Ax = B)

But i don't know what to do , i make matrix then max(n , m) * max(n ,m) Please help!

Thanks

Xor basis Technique

Ohh it is pollard rho I never have its implementation and now i have

Thanks

What is the complexity of the the function (anyDivisor of n) , Also what you do in it

Nopes , 120 pointer problem is good

++

Ohh i remember,Grredy way seems like sort it and check

but it there is a little missing information in the question that we not change the order i got this observation in a testcase and aced it

i dont know the question name Can you give hint what question it is so that i can say something related to this question

No this is not counter case bro. Ans is aggressively no Sum1 != sum2

if that is the case, then it is unfair for all since they skipped that problem by seeing accepted Better option is ig remove that problem contribution from ranking

is div2 rank 1 is not counted in price?

+3
I Have the same idea Like
for a vertex , find the set of distinct colors it attached to
    What it means is , we can go from a color of this set to any other color of this set

Now , But i do know how i proceed to implement it
Let me check your submission
+1
We need to decrese the max gap right (the one having max A[i] - A[i-1])
Now,we can just insert one element (What it would be!!)
    Obviously mid , mid = (A[i] + A[i-1]) / 2

So indirectly , Question transform to  find (i,j) such that D[i] + F[j] is closest to mid
This is two pointer right,  (Sort D and F and then find it right)
+4

Link?

I have seen this But never solve a problem which uses randomization idea Can you elaborate this question a bit more, it builds analogy for me like where and how to check if randomization work or not

I have a doubt here!

n/ln(n)  is approximately the number of primes <=n right

n/ln(n)  - (n/2)/ln(n/2)   is basically number of primes > (n/2)

What is this thing like  m/n > (1/30)  and randomize idea , i am beginner in randomize idea
Can you elaborate a bit or some related resource

CAn you share your approach for problem F find the tree?

0

i will look in this new approach in more detail tonight

0

i dont know , what you mean by checking euleria circuit I do it like : Make all of them in 4 groups-> 1) need a power and a power to the next one 2) just need a power to complete 3) just power to next one 4) no need a power and nor giving Then it is just ordering them in n positions
0

WHat eulerian circuit here , its combinatorics problem for me.

0

Why there are too much contest at the same time?

Can we register now?

i come across it just now!

Genralisation of 3rd one:
    gcd(a*b , c) = gcd(gcd(a,c) * gcd(b ,c) , c)

Previous year Unlock is cool, but this time i hated it and also gfg site Worst experience

in gfg or codeforces as previous year

Algo unclock shows 14 feb on unstop? is date changed


in c++ , a/b is by default floor ex: 6 / 4 = 1 , not 1.5 floor(a/b) = ((a -(a%b)) / b) 4/4 = 5/4 = 6/4 = 7/4 = 1 (each one is floored so all are equal) The thing in dealing with modulo directly with floor, is that it modulod 1.5 not 1 This is case needed in question, that we need to apply modulo to the floor value not the whole

This is not a technique , actually question wants the floor value , so i need to remove the remainder IN other cases no need to do that actually

You can check the cp algorithm for MMI

is problems sorted by difficuilty?

yaaa that is true or we write like  ((a%m)*((b)^-1)%m)%m

but here we need need 100/3  ~ not a integer , when you apply the above ,the decimal value also include which makes the answer wrong , to avoid that

a = a - (a%3)   , then you apply  , because you need floor value

if you do it directly , you get wrong since 10^x is always not divisible by 3. You should minus the remainder then you get the correct answer

Yaa got it I don't know much about suffix array, I solved less problem on it ~2 3 problem I look how it work for finding this thing Thanks for the idea

Ohh means you say like q.n constraint can be reduced right

I do it with hashing so it didn't affect my code then also ig

i got so much penalty because of this , otherwise my team is in top 20

I think you should extend the team to at least 40-50 for a Rigorous competition.

implementation any?

On HelloFromMarsMy AtCoder Guest, 2 years ago
+1

As I said, I will make it to my profile photo Thanks bro, it truly means a lot to me Thanks [submission:HelloFromMars]

On HelloFromMarsMy AtCoder Guest, 2 years ago
+3

HelloFromMars Please try mine

i will make it my profile photo

Ohh got it Thanks

i was thinking like, is it always exist that at least one of the pair in which both are positive?

i was thinking like one is incrementaed by a fac and other is decremented by a factor Is it possible to have some answer in other pairs also?

in problem d, i find (x,y) in d but dont know how it works if just making x>=0 or y>=0 gives us optimal answer

Any proof Yagnik_Dhameliya shadow9236

i solved e1 and e2 using small to large merging But I will look for dsu also

check my submission

Thanks bro

+1
in the url type ?mobile=false

i fixed that way

How you view them

On aeonaryMaximum path in a grid, 2 years ago
0
I think of 2 dps:
                     dp1[i][j] = max ans so far, we come here from (i-1,j) to (i,j)
                                               its is first time we come to ith row  
                     dp2[i][j] = max ans so far, we now go from (i,j) to (i+1 ,j)
                                               its is last time we in the ith row
dp2[i][j] = Max(k<j , dp1[i][k] + sum(A[i][k..j])
                k>j , dp1[i][k] + sum(A[i][j..k])
                k=j , dp1[i][j])
dp1[i][j] = dp2[i-1][j] + A[j]
-8

Ohhh get it Thanks

-18

How i participate it. Is i need to register before it is started?

0

is it started?

Check my submission, you can get another approach, somewhat similar but easy to undersatnd

when you dont try E, because of stucking in d :(((

Seems easy for me the E one. (I solved it in one go)

This happens with me also

Can somebody check what is wrong with my solution in problem n.
It seems like I am correct , but don't know if there is some mistake.
https://pastebin.com/h0WrBATx
//idea is like 1 4 , 2 3 , 1 1 1 2 , 1 1 3 , 1 1 1 1 1 , 0   (modules)
//  fix {1 , 4} with bs on {2 , 3}
Easisest solution for C :   (claim : total_operation <= 50)
    Pre-requiite : observation

    When you see the operation, insert '01' what it means?
             :-> Assume it is like a bracket () , 0 -> +1 , 1 -> -1
                 you can create a Perfect bracket sequence with the operation? (sounds cool)
                 Some property :  pref_sum >=0 , at last pref_sum =0
    Now, lets solve the Problem:
             one pointer at the left end , one at right end
             if(s[i]!=s[j]) -> we can continue,and move the pointer respectively
             otherwise, both is '1' or '0'
                 let '1' : we make pref =0, 
                           when we have an subarray whose pref=0 -> we can compensate it
                           otherwise not possible
                           Now you are confused that from which side we check for pref=0 condition
                           it turns out that  for '1' check from right pointer
                                              for '0' check from the left pointer
                 vice-versa for '0'

            Yaa We are done :

is editorial published?

Where is testers for specialists??:))

On VladosiyaHashing root trees, 3 years ago
-8

Is this working hash??

Yes , the registration has started. I got mail regarding ICPC amritapuri registration starting

me

Great I join as a team

is it team contest?