rumike's blog

By rumike, history, 3 days ago, In English

For the problem 1822G1 - Magic Triples (Easy Version), I submitted this code 261212704 that return TLE. The complexity of this is O(n * sqrt( Max)) which leads to 10^8 operations, so that code must passed when using c++ with basic operations.

After looked at the editorial, it's the same logic with same complexity, and after submitted the editorial code 261212704, I got accepted. Can someone find what's wrong? Thanks in advance

Full text and comments »

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

By rumike, history, 3 months ago, In English

You can find the problem there 1930F - Maximize the Difference.

Before you continue the reading, this is my first blog, I don't know how to write mathematical formulas with codeforces, as for example maximum over a set. If any advice for this it will be helpful.

Problem statement

Given an array b of m non-negative integers, we must calculate f(b) as the maximum value of max(bi|x)−min(bi|x) over all possible non-negative integers x.

And as hints, the editorial mention :

  1. For an array b consiting of m non-negative integers, f(b)=max(max(bi|bp)−min(bi|bp))

  2. f(b) is the maximum value of bi ∧ ~ bj over all pairs

If you have any solution feel free to comment on it. Thanks!!!

Full text and comments »

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