goextreme's blog

By goextreme, history, 4 months ago, In English

How can i submit solutions to the problems of Izho 2024. Also if anyone has problems of day 2 it would be really helpful if you shared it.

Full text and comments »

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

By goextreme, history, 5 months ago, In English

Monotonic Stacks:

  • Excel at:
    • Finding next greater or smaller elements in arrays
    • Tracking maximum/minimum values within a sliding window
    • Solving problems involving range queries with certain restrictions
  • Operations:
    • Push, pop, peek, find next greater/smaller element
  • Time complexity: Typically O(1) for operations, but can involve upfront processing
  • Space complexity: Usually O(n)

Segment Trees:

  • Excel at:
    • Range queries (sum, minimum, maximum, etc.)
    • Range updates (adding/subtracting values within ranges)
    • Solving problems involving range operations efficiently
  • Operations:
    • Query for information within a range
    • Update values within a range
  • Time complexity: Typically O(log n) for queries and updates
  • Space complexity: O(n)

When to Choose:

  • Monotonic stack: Use for problems involving finding next greater/smaller elements, sliding window maximum/minimum, or range queries with specific conditions where a stack-like structure is naturally suited.
  • Segment tree: Use for problems involving general range queries, range updates, or efficient range-based operations that don't align well with a stack's structure.

Key Considerations:

  • Implementation complexity: Monotonic stacks are generally simpler to implement than segment trees.
  • Code readability: Monotonic stacks often lead to more readable code for problems they are well-suited for.
  • Performance trade-offs: In some cases, segment trees might offer faster queries at the cost of increased space usage.

In summary:

  • While segment trees can be used to solve certain problems that monotonic stacks can, they are not universally interchangeable.
  • The choice depends on the specific problem requirements and the trade-offs between implementation complexity, code readability, and performance.

What do you think need to be changed ?

Full text and comments »

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

By goextreme, history, 6 months ago, In English

Before reading this blog i kindly ask you read the problem statement: https://vjudge.net/problem/UVA-714

I implemented a binary search solution for this problem and i am getting wrong answer verdict when i submitted.

My code

If you encounter any problems in my solution whether they are about logic or implementation, let me know.

Thanks in advance

Full text and comments »

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

By goextreme, history, 7 months ago, In English

Hi everyone. I was solving problem https://codeforces.com/contest/1759/problem/E and my solution is this: https://codeforces.com/contest/1759/submission/228398584

but unfortunately i failed test 3. can you help me to clarify which part of my submission is wrong

Full text and comments »

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

By goextreme, history, 8 months ago, In English

Normally how long it takes for atcoder to update ratings of contestant ?

(is it soo long)?

Full text and comments »

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

By goextreme, history, 9 months ago, In English

i was solving this problem and after making few submissions i thought now it would pass, but i got wrong answer on test two,cause 256th number differs :(

here is my submission: https://codeforces.com/contest/1736/submission/218110763

it says out of bounds on long long. how could this happen with the given constraints.

what's more i can't see that test-case. so, i wanted ask whether someone can help me for this one.

Full text and comments »

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

By goextreme, history, 9 months ago, In English

Hello everyone, i think most of you guys herd about https://codeforces.com/blog/entry/119110

can someone explain how to push the solution.in the instructions it is written push your solution, but didn't explain how and where?

Full text and comments »

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

By goextreme, history, 10 months ago, In English

I have learned basics of c++ and i can now solve some problems which are related to intuition, but i'm still not good at implementation stuff...

So, before learning data structures i found out that i have to learn STL Library of C++

Can someone suggest anything like how can i learn it and become comfortable with it and what should i do next?

Thanks in advance:)

You can downvote if you want, but i need advice :)

Full text and comments »

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

By goextreme, history, 10 months ago, In English

I have problem with the last contest's problem B:

you can visit my code with sample case here

i don't understand why my code is not working even for the sample cases

can someone help me on this stuff, i would be really happy, thanks in advance

Full text and comments »

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

By goextreme, 10 months ago, In English

i was solving this problem

i got wrong answer many times(you can refer to my last submissions) on test 1, but when i checked myself with sample test-cases i got right answers.

I wonder why?

my last submission

can someone explain reason or give some hints , thanks in advance

Full text and comments »

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

By goextreme, history, 10 months ago, In English

Hi everyone, thank you for reading this blog. If you know c++ can you please keep reading to help me

problem: 1846C

my submission

i solved this problem in python, but i got runtime error on test 3 when i tried to do it using c++

i don't understand why i got runtime error on test 3. can somebody explain this to me

Thanks in advance

Full text and comments »

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