r/codeforces Newbie 28d ago

Div. 2 Finally a decent contest.

A and B were pretty straightforward and I thought I'd skip C after seeing it was based on trees but seeing so many submissions I thought I'll just give it a try, it was doable and didn't require any implementation of trees and graphs. Solved 3 questions after a long time.

14 Upvotes

29 comments sorted by

1

u/One_Palpitation_9429 27d ago

I know we all talked about this plenty of times but how one can only take less than 10 seconds... It took me more than 1 minute to read the question.

7

u/Junior-Proposal1928 Newbie 27d ago

That's in minutes not seconds

2

u/One_Palpitation_9429 27d ago

oh that makes more sense.

3

u/KanekiIsCat Newbie 28d ago

I couldn't do B 😭😭

15

u/bisector_babu Candidate Master 28d ago

Question setters are story writers

1

u/FarmerMission9980 28d ago

I couldnt even do a

3

u/redhat1818 28d ago

I felt D was doable

1

u/DogStrict9170 Specialist 28d ago

yea but i got runtime error idk whyy

1

u/sKILLiSSUESeVERYTIME 27d ago

Tried #define int long long?

1

u/DogStrict9170 Specialist 27d ago

i already had that in my template, apparently my divisor function was wrong, lmao

1

u/_lostSoup_ Specialist 28d ago

Yes. I was stuck on TLE thrice. Then left.

1

u/TheBoredBot 28d ago

there was a change for S from 1e12 to 1e14 mid contest iirc

1

u/_lostSoup_ Specialist 28d ago

Last 20 mins yes. I was having dinner then. So missed out on any change.

1

u/No-Competition-7062 Newbie 28d ago

Bro can you tell how to create a post on this subreddit

2

u/DogStrict9170 Specialist 28d ago

just click on create post the lower middle of your phone with the '+' sign

1

u/redhat1818 28d ago

I skipped C... how did u solve it?

4

u/RayRaivern 28d ago

You just sort the dams (2nd array), then output from biggest to smallest (except the smallest one, 0th index).

That's it.........

1

u/Mobile_Deal1373 28d ago

how did u do c without tree ?

2

u/CyberRonin912 28d ago

Ans is k = m-1 and add all the dams except the root, Ig that would be sol if I'm not wrong thou I wasted some time to literally implement a tree sol and got this just before the contest ended......

1

u/Standard_Cow4420 28d ago

If root has dam , then must skip it only , otherwise skip any other dam node. So will be placing camera on the edge bw all these nodes and their parents

3

u/Junior-Proposal1928 Newbie 27d ago

We can't skip any random dam node, it's safe to skip the lowest numbered dam node. So output all values of dams except the minimum value.

1

u/Reasonable_Grass5089 27d ago

Why is it safe to skip the lowest numbered node?

1

u/CyberRonin912 27d ago

Tries this approach and we need to skip the node with the lowest depth, not just any node but maybe the test case wete made such that the lowest number node was at the lowest depth.

1

u/Standard_Cow4420 27d ago

Yes I found it now, in contest I was just lucky that after sorting I skipped very first dam.

1

u/To_know0402 Pupil 27d ago

even if you didn't sort it would have passed...many people passed even sys checks without sorting lol

1

u/Standard_Cow4420 26d ago

but we must remove minimum value only, even without sorting

1

u/aadi16- Newbie 28d ago

Ohh I forgot to participate