Комментарии
На atoizCodeforces Round #666, 6 лет назад
0

devil was right

Maybe you have checked only a specific case in your second for loop. It will be better if you try to make the original string from the answer and then compare.

See this answer

+19

Problem D looked like a standard interview problem.

Solution for C: Initialize a string str of 1's of same size. In C just put 0 on both side of string str at x distance, if you get 0 at a position in input string. For -1 condition : Check if you can form input string from the string str according to given rules. If you can't form input string print -1.

На 055DCodeforces Round #665 (Div. 2), 6 лет назад
0

One of the most stable and decent question sets.

На karavaievCodeforces Round #660 Editorial, 6 лет назад
0

nice try

На karavaievCodeforces Round #660 Editorial, 6 лет назад
0

I feel problem C was easy ,but it's framing was not proper.

На awooEducational Codeforces Round 92 Editorial, 6 лет назад
0

got it.

На awooEducational Codeforces Round 92 Editorial, 6 лет назад
0

Hey @adedalic I have one doubt in D, You have said,

In the case of non-intersecting [l1,l2] and [r1,r2], we should at first "invest" some number of steps in each pair to make them intersect. So let's iterate over the number of segments to "invest" cntInv. We should make cntInv⋅(max(l1,l2)−min(r1,r2)) steps to make segments touch. Now, cntInv segments touch so we can use almost the same formulas for them as in the previous case.
But consider case where input is,
5 16
1 4
8 12 
In this case should we invest time in joining all pairs or just invest time in joining one pair 
and complete operations using only that pair.
So steps for joining = 4
Steps to make both equal size = 11 , remaining k = 5.
So instead of joining all pairs just invest in first joined pair.
Remaining steps = 5*2 = 10.
Ans = 4 + 11 + 10.

Why should we invest in joining all pairs ? Am I missing something ? Community, Please help !!!

EDIT: Now I get it, u have used a for loop (i to n), that checks by joining first i pairs and compares it with minimum each time . Thanks.

this mistake cost me 2 WAs but finally caught it by testing new samples.

На _cianHow to use new to make a node, 6 лет назад
0

There is a constructor in struct declaration ( Node(int x) {.....} ) , when you create a node you need to pass a value such this constructor function gets initialized.

Node* new_node = new Node(5).
//This calls the constructor function whenever the object is created.
// data = 5 ; next = NULL.

Read about constructors online. Learn about default and parameterized constructors.

На gotexansCodeforces Round #655 Editorial, 6 лет назад
0

Okay, okay I understood now, Even if $$$a_{i+1}$$$ and $$$a_{1+2}$$$ are adjacent, in the next step I will either lose the container in which $$$a_{i+1}$$$ is added or the container in which $$$a_{i+2}$$$ is added, because the containers will be adjacent. If the containers don't get deleted till the end, then $$$a_{i+1}$$$ and $$$a_{1+2}$$$ will be the only adjacent elements in our answer !!! .`

На gotexansCodeforces Round #655 Editorial, 6 лет назад
0

Consider ... $$$a_{i-1}$$$,$$$a_{i}$$$,$$$a_{i+1}$$$,$$$a_{i+2}$$$,$$$a_{i+3}$$$ ,$$$a_{i+4}$$$.... If I remove $$$a_{i}$$$ and $$$a_{i+3}$$$, then this would add $$$a_{i-1}$$$,$$$a_{i+1}$$$,$$$a_{i+2}$$$ and $$$a_{i+4}$$$ to the answer. Here $$$a_{i+1}$$$ and $$$a_{i+2}$$$ are adjacent elements and also I am not in my last step. This is confusing !!!

$$$a_{i-1}$$$,$$$a_{i}$$$,$$$a_{i+1}$$$,$$$a_{i+2}$$$,$$$a_{i+3}$$$ and $$$a_{i+4}$$$

a_{i+1}

На rng_58Codeforces Round #162 Tutorial, 6 лет назад
0

Thanks !!

He is |%|e

:D

I'll climb ladders then. Happy fixing.

На awooEducational Codeforces Round 80 Editorial, 6 лет назад
0

adedalic why didn't you use ceil() function in problem A. I think I got WA on TC 22 because I used ceil(). My solution 1: link My soln 2 :using_binary_search Both give WA in TC 22.