Comments

Wowwww!! This is super explanation!! Really Helpful. Thank you and keep it up!

I have a Nice Solution for 2026B - Black Cells:

case 1: when n = 1, we can choose a[0]-1 or a[0]+1 as the optional white cell to paired up. Thus the answer is 1:

case 2: when n is even there is no need to use any extra white cell as there is already a perfect pairing exist. Hence the answer is the maximum difference between adjacent indices: (a1, a2) (a3, a4) and so on...

case3: n is odd is the only tricky case where we must have to use the extra white cell to make up balanced pair. Now look at the even indices, do they have to pair up with the extra cell we are going to add? No! Because then paring imbalance happens on both side of the even indices we choose.

So, only odd indices can pair up with the extra white cell (though we really don't have to add it, just have to imagine we add the cell next to it). Now the answer is minimum of [maximum pair difference on both side] of all possible odd indices we choose.

Here is my solution: 298661203

Time complexity: O(n^2)

However, we can do it in O(n) by using prefix and suffix max pair difference array.

O(m^2) solution is going to give you TLE as m<=3e5

bro It's div (1 + 2)

YES!! I also enjoyed Problem D

Special Thanks to cmk666 for the nice problem 2048D - Kevin and Competition Memories

No need take inverse modulo of 2, Yes you can, n or n-1 is even hence it's divisible by 2!! just take inverse mod of (n * (n-1)/2) % mod And it works!!
My submission: 279251237

I have slightly different solution for 2008B - Квадрат или нет than the solution given by authors: It's clearly mention that the string s is derived from a beautiful matrix, so if it has to be squared two conditions are suffices:

Initially we count how many ones and zeros are present in the mentioned beautiful matrix, It's pretty easy, right? Number of ones = r + r + c-2 + c-2
Number of zeros = n * n -Number of ones

  1. Length of the string should be a perfect square and,

  2. count of zeros and ones are exactly as same as we count for beautiful matrix.

And It works!!

Here is my submission: 279088062

In editorial of G2 , if a < x <= b, area should be a * (b + 1) but given (a+1) * b. May be it's a Typo SlavicG

Hints for 104493K - Sam-Oh, the funny coach: As the given string are sorted so, we can just store the starting and ending position of each 26(a to z) character for every string. Now for each query just go through the stored index of each 26 character add the length of intersection of both string and finally print it (note: Try to store index in light structure otherwise there will be MLE or TLE)!

Just apply the operation on 2 x 2 submatrix! (It would better if you have a look at the solution of 1119C - Ramesses and Corner Inversion)

1983B - Corner Twist is almost coincide with 1119C - Ramesses and Corner Inversion and required same technique to solve MrSavageVS!

In case of minimization, it's always correct. Because the intuition behind is that You never want to multiply number that gives greater result than just adding those two numbers. And that's what asked in the problem statement.

I didn't able to guess it at the contest time! Sad Life!

Problem 1986D - Mathematical Problem solution:

Key observation: As we can use only n-2 sign (+, x), so there must be at least one two-digit number. Then just find the minimum answer as asked.

-Time Complexity O(n ^ 2)

        int n; 
	string s;
	cin >> n >> s;
	int ans = INT_MAX;
	for(int i = 1; i<n; i++){
		int num = stoi(s.substr(i-1, 2)); 
		for(int j = 0; j<n; j++){
			if(j==i-1 || j==i) continue;
			int cur = s[j]-'0';
			num = min(num*cur, num + cur);
		}
		ans = min(ans, num);
	}
	cout << ans << '\n';

High Quality tasks!!!

Great problem Indeed!! Enjoyed very much..should have able to solve C and D. I even calculate the suffix array for C and still not able find suf[i]>0 contribute in the answer..Very frustrating!

OH sorry!

Problem D is the best one with little bit of geometrical thinking and number theory. Love this one Ashutosh.Singh

Problem 1895C - Torn Lucky Ticket is a fantastic Problem!! Thank you for this problem..

May be there is a misunderstanding. How the complexity is O(qlogn)? ..ans every query by binary search and inside every transition of binary search finding "AND" of (l to mid) take O( q* (log(n) )^2)

I think, my solution can be optimized a little bit to gain expected complexity.

Would you mind giving me the code?

NOP! It cause TLE. It is because the complexity will be O(q * n * log(n)), but expected is O(q*log(n)) or O(q * (log(n))^2)

Here it is: 225454109

I think the most easier way (I mean no need handle bit by bit) to do 1878E - Iva & Pav is to use seg tree. Here is my solution: 225454109

Man.. I just started last div3 contest in virtual mode, did A, then going to open Problem B...And BOOOOOM..

On yummyCROC 2016 — Elimination, 3 years ago
0

Did the same 219648940 but got WA on 60!

On JuicyGrapeSashaT9 Contest 1, 3 years ago
0

problem F is reversed of an ABC problem, where author asked to maximized diameter.

0

Agree! Statement is foggy!

Hey CristianoPenaldo, first one to solve div2 B. I love to mention your name for no reason!!

For Round 3: Problem->G:Cantor Expansion

Agreed!!

In Problem E solution. The Function is_parent() is actually checking if a is anchestor of b, not only direct parent. Correct me if I'm wrong. And I didn't get the u = Lca(u, lvl[u]-lv[v]-1) part.. Please help...Alfeh

On plateletCodeTON Round 5 Editorial, 3 years ago
+22

In Problem 'A' solution , sum(ai) < sum(bi) , then anser is Tenzing...typing mistake in tutorial(sorry for bad English).platelet

Very nice problemset (though more than expected tree problems) & perfectly balanced contest..Author should get ++.....+INF contribution.

I have exactly the same idea, but i was unable to implement the solution..very sad

When it is possible to add a path from s -> t , where distance = dis[s->t]+1?? it is only possible when for any two adjacent node are at the same distance from 's', and dis[s->u] + dis[t->v] + (u->v or v->u) = dis[s->t]+1. (here u, v are two adjacent node)

That's it!

This is really great!!

Very Sad!!

+14

LOL...n = 1 is even in the sample test!!

my idea for H ( but get WA2):

  1. Set u as root and run bfs get distance of all other node by edge weight as 1.

  2. Using the distance array get the given maximum weight at distance x for all node.( maxw[ dis [ x ] ])

  3. Then ans will be maxw [ min ( distance of farthest node, L)l).

Pls help!

Great!

lets say the problem has input file as

input : path.in

output: standard output

then how I will modify your ans??

Problems are seems harder than usual div3...though they are fantastic..

Consider the subtree containing node 1,2,3,4(for node 1)

Why 199309430 this got AC (after the contest) and 199271425 this got TLE(at contest). The difference I made between those two submission is declearing adgacency list of size 2e5(TLE) and 5e4(AC). Then assuming more memory cause TLE instead of MLE??

0

NOP...It's scam!

0

How on earth Yodasen made possible to write solution and submit within the time interval of 5 second (solution A(3 min 53s) & D(3 min 48s)) and 21 second (solution C(7 min 30s) & G1(7 min 9s)) second!

Is this real??

0

I love them very much...Last few days (3 to 5) I solved more than 10 interactive problem and enjoyed those problem very much.. And finally today I was able to decipher the given one!! YOWWWWWWW

0

Wow!!! Super excited to participate in another Bangladeshi Round after a long time.. Orz adnan_toky & Shefin_

First of all I didn't participate the contest...After the end of the contest I was searching for solution of problem C..And Youtube suggest(As you know) some of the related vedios...after clicking the vedio I saw the uploading time was in the middle of the contest .. Note: You can Check

This youtube channel upload vedio on problem A & B solution at contest time.. report this channel..

In the previous contest (Round 822), I also comment (reason: as you did today) about this guy. Sir MikeMirzayanov please have a look at it!

First of all thanks for nice hints! Note: Number of Council is atleast 1 as k <= n and all group (1 to n) consists atleast a student.

So, if just wrote those line like: ans += (ar[i] + rem )/c; rem = ar[i] % c will it work??It should be as your explanation because I didn't accumulate rem. but unfortunately I got 8 times WA by using those line..

I love to see code of Farhod , peti1234 , QAQAutoMaton, Petr & Um_nik as they write very neat and understandable solution. I'm trying to learn as much as I can from their code( for me it's may be A, B or C).

yes! got AC...a little bit sad for that silly mistake..however!Now I get relife that my idea wasn't wrong.

oo..thanks!

I got wrong on TC2 on C (my submission).... Please help!

Is anyone facing long queue while submitting solution(in practice mode)?.

us.....!

Best contest I've ever participated. Problem statement was so clear and look like easy pessy but too much tricky.I wish I will solve at least two problem in the next contest in future by this author YouKn0wWho

Editorial Please.... How long we, the noobs have to wait....

On pllkBinary search implementation, 5 years ago
0

Thank you bro...

actually I used a = n-1 for the array bound, but I didn't thought it that if (n-1) isn't a power of 2 then using ( if ) statement instead of ( while ) will give an error....

Thank you again for giving your time...

On pllkBinary search implementation, 5 years ago
0

This Code Work Perfectly::

int main(){

IOS;

int t; cin >> t;

while(t--){

int  n, target;
    cin >> n >> target;
    vctr v(n);
    Trav(x, v) cin >> x;
    SRT(v);

    if(v[n-1] < target  || v[0] > target) 
                             cout <<target<< " is Out of Range\n"; 

    else{

    int pos = 0;

    for(int a = n-1; a > 0; a/=2){

        //while(pos+a < n and v[pos+a] <= target) pos+=a;
             if(pos+a < n and v[pos+a] <= target) pos+=a;
    }

   if(v[pos]==target) 
                 cout << target <<" is present in the array at index "<<pos+1<<"\n";
           else 
                 cout <<"Opps! "<< target <<" is not found in the array\n";
    }

}

return 0;

}

Input::

4

5 5

1 2 3 4 5

5 4

1 2 3 4 5

5 1

1 2 3 4 5

5 100

1 2 3 4 5

Output::

5 is present in the array at index 5

4 is present in the array at index 4

1 is present in the array at index 1

100 is Out of Range

===== Used: 0 ms, 4 KB

On pllkBinary search implementation, 5 years ago
0

while is needed, because the steps are not always powers of 2. ****If not ,Then please let me learn how the run time could be log2(n)???

May be the best movie I've ever seen.(apart 'Parasite')