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

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

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!

Full text and comments »

Tags dp
  • Vote: I like it
  • -6
  • Vote: I do not like it

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

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 ?

Full text and comments »

  • Vote: I like it
  • +27
  • Vote: I do not like it

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

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 ?

Thank you for reading.

Full text and comments »

  • Vote: I like it
  • +11
  • Vote: I do not like it

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

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

Please help I going crazy because of this problem.

Thank you for reading.

Full text and comments »

  • Vote: I like it
  • +2
  • Vote: I do not like it

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

Hello everyone.

I've been trying to solve this problem 455D - Serega and Fun 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.

:)

Full text and comments »

  • Vote: I like it
  • +3
  • Vote: I do not like it

By M.A.H.M.O.O.D, history, 8 years ago, In English

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;

Thank you for reading.

:)

Full text and comments »

  • Vote: I like it
  • +15
  • Vote: I do not like it

By M.A.H.M.O.O.D, history, 8 years ago, In English

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.

Thank you for reading.

:)

Full text and comments »

  • Vote: I like it
  • -7
  • Vote: I do not like it

By M.A.H.M.O.O.D, history, 8 years ago, In English

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 ???

I hope this will raise the attention of the admins about this problem.

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

:)

Full text and comments »

  • Vote: I like it
  • +45
  • Vote: I do not like it

By M.A.H.M.O.O.D, history, 8 years ago, In English

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!!!

:)

Full text and comments »

  • Vote: I like it
  • +3
  • Vote: I do not like it

By M.A.H.M.O.O.D, history, 8 years ago, In English

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 - Hongcow Buys a Deck of Cards 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 ???

Thank you for reading...

:)

Full text and comments »

  • Vote: I like it
  • +7
  • Vote: I do not like it

By M.A.H.M.O.O.D, history, 8 years ago, In English

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...

Thank you for reading.

:)

Full text and comments »

  • Vote: I like it
  • -2
  • Vote: I do not like it

By M.A.H.M.O.O.D, history, 8 years ago, In English

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.

Thank you for reading.

:)

Full text and comments »

  • Vote: I like it
  • -7
  • Vote: I do not like it

By M.A.H.M.O.O.D, history, 8 years ago, In English

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.

Thank you for reading.

:)

Full text and comments »

  • Vote: I like it
  • +10
  • Vote: I do not like it

By M.A.H.M.O.O.D, history, 8 years ago, In English

Good day everyone,

Today I was solving 731C - Носки and I was getting TLE on test 32.

I really have no idea what is causing the TLE can somebody please help me ?

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

My submission: 22259984.

Thank you for reading.

:)

Full text and comments »

Tags dfs, tle
  • Vote: I like it
  • +3
  • Vote: I do not like it

By M.A.H.M.O.O.D, history, 8 years ago, In English

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.

Thank you for reading.

:)

Full text and comments »

  • Vote: I like it
  • +26
  • Vote: I do not like it

By M.A.H.M.O.O.D, history, 8 years ago, In English

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.

Thank you for reading.

:)

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By M.A.H.M.O.O.D, history, 8 years ago, In English

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 ???

Thank you for reading.

My submission 21828109

:)

Full text and comments »

  • Vote: I like it
  • -3
  • Vote: I do not like it

By M.A.H.M.O.O.D, history, 8 years ago, In English

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.

thank you for reading.

:)

Full text and comments »

  • Vote: I like it
  • +5
  • Vote: I do not like it

By M.A.H.M.O.O.D, history, 8 years ago, In English

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.

:)

Full text and comments »

  • Vote: I like it
  • -3
  • Vote: I do not like it

By M.A.H.M.O.O.D, history, 8 years ago, In English

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

:)

Full text and comments »

  • Vote: I like it
  • +4
  • Vote: I do not like it

By M.A.H.M.O.O.D, history, 8 years ago, In English

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 - Цивилизация

19871836

Thanks in advance and have a nice day.

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By M.A.H.M.O.O.D, history, 8 years ago, In English

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

Full text and comments »

  • Vote: I like it
  • -37
  • Vote: I do not like it

By M.A.H.M.O.O.D, history, 8 years ago, In English

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

Full text and comments »

  • Vote: I like it
  • +2
  • Vote: I do not like it

By M.A.H.M.O.O.D, history, 8 years ago, In English

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.

Please keep it simple.

Thanks in advance.

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By M.A.H.M.O.O.D, history, 8 years ago, In English

Good day. So today I was trying to solve this problem 580C - Kefa and Park but as soon as I submitted it I got a wrong answer on test 1 I tried the input of test one locally and it gave a right answer but submitting it gives a wrong answer I double checked the compiler that I was using and I didn't get anywhere. Do you have an idea what's going on??? here's my submission 18172263. Thanks in advance.

Full text and comments »

  • Vote: I like it
  • -4
  • Vote: I do not like it