### M.A.H.M.O.O.D's blog

By M.A.H.M.O.O.D, history, 4 years ago,

Hello everyone.

I was trying to solve this problem and I couldn't, so I tried looking at the tutorial and I didn't understand it.

Can someone explain the solution for me please? Just the general idea not the implementation. Thanks!

• -6

By M.A.H.M.O.O.D, history, 5 years ago,

Hello everyone.

I was surfing the net looking for information on APIO 2018, but it seems that nothing has been decided about it.

I know that the APIO is held every May, so that doesn't give a lot of time for the organizers to plan the event. Does anybody know anything about it?

I wasn't able to find the hosting country. Do you think that there won't be an APIO this year ?

• +27

By M.A.H.M.O.O.D, history, 5 years ago,

Good day everyone.

Today I was trying to solve a problem that required 2D segment trees so I tried to learn them. I didn't get enough resources and the ones I got I didn't understand.

I have encountered the word 'quadtree' a lot so I have a couple of questions.

Could somebody tell me the diffrence between quadtrees and 2D-segment trees or are they the same? and could somebody point me to an article the explains 2D-segment trees well enough to be understood by me. Or can someone explain it here please ?

• +11

By M.A.H.M.O.O.D, history, 6 years ago,

Hello everyone.

I have been trying to solve 455D - Serega and Fun for a long while now and I really need some help.

I can't figure out what's wrong in my solution could someone please help me or at least give a test case where my solution will fail.

Note: I'm using SQ-RT decomposition to solve this problem and when I change the value of SQ I get WA on a different test each time.

Here's my submission : 27521539

• +2

By M.A.H.M.O.O.D, history, 6 years ago,

Hello everyone.

I've been trying to solve this problem 455D - Серега и веселье but I keep getting RE on test case #9.

I don't know what's wrong with my code could someone please help me in figuring out what's wrong or atleast give me a test case where my solution breaks ??

Here's my submission : 27468511

Thank you very much for reading.

:)

• +3

By M.A.H.M.O.O.D, history, 6 years ago,

Hello everyone.

I'm going to participate in APIO 2017 and so I decided to try to solve the problems of previous years but I wasn't able to solve them.

I didn't find any tutorial for the problems so I would like to ask you guys and gals to explain the solutions of the last year's problems.

Also I would like to know the intended solution for the 2nd subtask from problem boats and 2nd subtask from problem fireworks (not the solution that would get the whole problem just the one that would get this subtask).

Any solution provided will be appreciated;

:)

• +15

By M.A.H.M.O.O.D, history, 6 years ago,

Hi everyone.

I'm trying to solve this problem 559B - Equivalent Strings but I'm getting TLE here's my submission 26805388.

Now let's calculate the time complexity of this solution one call of function "is_equal" is O(n) in complexity because of the "substr" function which is linear in complexity.

Now for how many times we will call function "is_equal"...it should be O(log(n)) because each time we are halving the strings so the numbers of times I can do that is log(n) right ?

So the total time complexity should be O(NlogN) right ??? why am I getting TLE is there anything that I'm missing ??? I will be grateful for any help.

:)

• -7

By M.A.H.M.O.O.D, history, 6 years ago,

Hi everyone.

There's a problem that I've seen on the status page which is that you cannot see any status page other than the first for example if you go to the bottom of the page and click on the second part of the page it will say that the page is blocked by admins.

Now this bug has been around for a while and I always think it will be fixed after the next contest but it's been too long.

Can I at least know why is there a ban on the status page ???

UPD: Still not fixed it's been 4 weeks!!!

:)

• +45

By M.A.H.M.O.O.D, history, 6 years ago,

Good day everyone.

Yesterday me and my friend repeating did a warm up for the ACM contest that is coming up later this month.

We went to solve this contest from the gym 2015 PSUT Coding Marathon.

We solved almost all the problems except the last one problem L.

We didn't get any idea regarding the problem could someone please provide some help...a hint maybe.

We will be very grateful...thanks in advance!!!

:)

• +3

By M.A.H.M.O.O.D, history, 6 years ago,

Hi everyone...

I'm trying to practice DP problems these days I feel that I'm good at them but I still need to get better...

Searching through codeforces for a good DP problem might take more time than actually solving it and I don't get a lot of time for training so I would like to make the best of my time...

I would be very grateful if you could share a DP problem on codeforces that you see is good/everyone should solve it...

I don't want standard DP problems I want something that has an idea behind it...like this one 745E - Коровоконг покупает колоду карт for example it took me a lot of time and lot of thinking but finally I've solved it and I really really liked it...could you please share something familiar ???

:)

• +7

By M.A.H.M.O.O.D, history, 6 years ago,

Hi everyone I've been trying to solve 744C - Hongcow Buys a Deck of Cards for a while now but still I haven't figured it out yet...

I've tried reading the Tutorial and reading a few codes but that didn't help much...

I will be very grateful if someone could please explain how to solve it in a detailed manner...

:)

• -2

By M.A.H.M.O.O.D, history, 6 years ago,

Good day CF community.

Today I tried to challenge myself and solve a hard problem and I did...kinda.

Right now I'm stuck in test 8 I have no idea what's wrong with my solution could somebody please help me out ???

Here is my code 22656856 and the problem 588E - Duff in the Army.

My idea is to find the IDs from node u to node 1 and from node v to node 1 and from LCA(u,v) to node 1 and then my answer will be (IDs(u) + IDs(v) — IDs(LCA(u,v))) I'm not sure if the idea is wrong or the implementation.

I'll be very grateful for any kind of help.

:)

• -7

By M.A.H.M.O.O.D, history, 6 years ago,

Hi everyone,

I was just solving 707D - Persistent Bookcase and I got WA on test 9.

I really have no idea what's wrong with my solution could somebody please help me to debug it I've tried real hard but to no avail.

my code 22511356.

:)

• +10

By M.A.H.M.O.O.D, history, 6 years ago,

Good day everyone,

Today I was solving 731C - Socks and I was getting TLE on test 32.

Note: that in my submission my code gave an answer but still it was counted as TLE.

My submission: 22259984.

:)

• +3

By M.A.H.M.O.O.D, history, 6 years ago,

Hi everyone.

There's something that has been bothering me for a while now sometimes I don't know how to solve a problem and I have to check the tutorial for answers...the problem is that I want a hint not the solution because I don't want to spoil the problem because it's a nice one and it's not common to find nice problems(at least not for me).

So I think there should be an area where people can post comments about the problem maybe links to similar problems or hints for the problem a link to an easy to read code other than the tutorial's just like SPOJ has.

It'd be nice to have such an area where a specific problem can be discussed and to avoid spoiling the fun for everyone we can make put the button to enter the discussion area right next to the number of people who has solved it.

So what do you think guys I want to know your opinion.

:)

• +26

By M.A.H.M.O.O.D, history, 6 years ago,

Good day to you all.

for a while now I've been trying to debug my solution for this problem 733C - Epidemic in Monstropolis but I haven't figured it out...I got WA on test 64 and the test data is too huge to see where I went wrong I was hoping if you guys could help me out I'd be very grateful.

The link to my code 22018901.

:)

• 0

By M.A.H.M.O.O.D, history, 6 years ago,

Hi everyone.

I'm trying to solve this 687A - NP-Hard Problem but I'm getting WA on test 15 and the input is too large for me to process where I'm going wrong, So I was hoping that someone that has solved it would take a look at my code and tell me where I'm going wrong ???

My submission 21828109

:)

• -3

By M.A.H.M.O.O.D, history, 6 years ago,

Hi everyone.

I'm trying to solve GSS1 in spoj (link) but I'm getting WA can anybody please tell me what's wrong ???

here's my code.

I really need help I'd be very grateful for any kind of assist.

:)

• +5

By M.A.H.M.O.O.D, history, 6 years ago,

Good day everybody.

So yesterday I was trying to solve this problem here and now I need some help please.

So my problem is this in my soultion I got AC on the first test and RE on the rest I looked in the help section of the site and it turned out the RE might be caused by some large STL the only STL I was using was a queue so I put an if statment that if the queue size was bigger that 10000 stop putting stuff in the queue and it worked...sort of.

You see now I'm getting WA on tests 2 , 3 and 4 and AC on the rest and on tests 2 , 3 and 4 my program isn't outputing anything and that's because of the queue limit so now I'm asking you this can you tell me what is wrong with my code and how to fix it or do you have a working code for the problem or is there any site that has working C++ codes for old IOI problems.

Here's my code.

Any help is much appreciated.

thank you and sorry for the long post.

:)

• -3

By M.A.H.M.O.O.D, history, 7 years ago,

Hi everyone

so today I was solving 645C - Enduring Exodus and I was struck by TLE.

I'm not pretty sure but I think that my solution should pass can you help me figure out if it's a coding bug or is the idea complete wrong I think that my solution's complexity is O(3N).

my submission 20031002

thank you very much

:)

• +4

By M.A.H.M.O.O.D, history, 7 years ago,

Hi everyone.

I can't solve this problem I have tried so much can you please tell me what's wrong with my code I keep getting WA on 42.

456E - Civilization

19871836

Thanks in advance and have a nice day.

• 0

By M.A.H.M.O.O.D, history, 7 years ago,

I'm not complaining or anything but it's wired not to have a contest to forward to.photo

• -37

By M.A.H.M.O.O.D, history, 7 years ago,

Hi codeforces.

My coach gave me a problem the other day and I'm still stuck in it and I have no idea on how to solve it.

I was wondering if you could help me.

It goes like this:

You are in a candy workshop you have N candies , M boxes with the capacity of C units and each candy has it's own wight.

The candies are in a production line so you can't rearrange them you are standing in the front of the line and you have to bag as many candies as you can.

When a candy piece arrives to you , you have 3 choices

1) take the candy and subtract it's wight from the remaining wight of the box ( as long as it's wight is less or equal to the box's remaining wight)

2) discard the candy( NOTE : that you can not take the candy again )

3) close the box you have and open a new one ( if you have a box left )

What is the maximum number of candies you can bag in the boxes.

NOTE : that you stand in the left of the production line.

1 <= N <= 1000000 1 <= M,C <= 1000000

e.g:

N = 8

M = 2

C = 20

The candies are 12 8 5 10 13 15 4 7

The output is : 5

You can take 12 and 8 and put them in the first box and close it then you can take 5 and 10 and 4 and you're done.

e.g2:

N = 24

M = 1

C = 20

The candies are 13 7 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 7 13

The output is : 20

• +2

By M.A.H.M.O.O.D, history, 7 years ago,

Hi codeforcer.

So let's cut right to the chase given N where 1<=N<=5000000 find the number of the prime factors the make up N.

e.g. 6=2*3 =>the answer for 6 is 2.

e.g. 12=2*2*3 =>the answer for 12 is 3.

I think it's called prime factorialzition or prime decomposition I'm not sure since my English with math vocabulary is worse than my coding skills.