Блог пользователя LMydd0225

Автор LMydd0225, история, 5 часов назад, По-английски

2007A - Dora's Set

Hint 1
Hint 2
Hint 3
Tutorial
Implementation

2007B - Index and Maximum Value

Hint
Tutorial
Implementation

2007C - Dora and C++

Hint1
Hint2
Tutorial
Implementation

2006A - Iris and Game on the Tree

Hint1
Hint2
Hint3
Tutorial
Implementation

2006B - Iris and the Tree

Titbits
Hint1
Hint2
Tutorial
Implementation
Bonus

2006C - Eri and Expanded Sets

Hint1
Hint2
Hint3
Tutorial
Implementation - two pointers
Implementation - sparse table
Bonus

2006D - Iris and Adjacent Products

Hint1
Hint2
Hint3
Tutorial
Implementation

2006E - Iris's Full Binary Tree

Hint1
Hint2
Hint3
Hint4
Hint5
Tutorial
Implementation

2006F - Dora's Paint

Here're two methods. Method $$$1$$$ is my method, and method $$$2$$$ is some testers' method.

Method 1:

Hint1
Hint2
Hint3
Hint4
Hint5
Tutorial
Implementation - method 1

Method 2:

Hint1
Hint2
Hint3
Hint4
Tutorial
Implementation - method 2
Разбор задач Codeforces Round 969 (Div. 1)
Разбор задач Codeforces Round 969 (Div. 2)
  • Проголосовать: нравится
  • +58
  • Проголосовать: не нравится

»
5 часов назад, # |
Rev. 5   Проголосовать: нравится 0 Проголосовать: не нравится

Congratulations Tourist for crossing 4000 rating!

»
5 часов назад, # |
  Проголосовать: нравится +36 Проголосовать: не нравится

Congratulations for tourist for reaching $$$4000$$$ rating, which is the highest rating on Codeforces ever! I'm proud to see that in my contest!

»
5 часов назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

Thanks for the quick Editorial and congratulations for tourist for reaching $$$4000$$$ rating! I can't to believe that, but that's true!

»
5 часов назад, # |
Rev. 2   Проголосовать: нравится +3 Проголосовать: не нравится

Can someone suggest me what minor changes should be done in this submission-278848822 so that it passes 5th case without TLE !! Thanks

  • »
    »
    5 часов назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Your solution's time complexity is O(m*n), which exceeds 10^8. Instead of updating the entire array, update only the maximum value as explained in the editorial.

  • »
    »
    5 часов назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    You are basically brute forcing on entire array for each operation. Basically you have time complexity of n*m. Instead there's a hack that you don't need to update whole array for each of m operations. Instead maintain a maximum element value and update it each time.

    • »
      »
      »
      2 часа назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      Does brute-forcing every question is bad in long run?? Should i stop brute-forcing question focus more on optimizing the solution and writing it ?! Neerav03

»
5 часов назад, # |
  Проголосовать: нравится +4 Проголосовать: не нравится

Instead of solving div1B I solved the bonus mid-contest O_O

»
5 часов назад, # |
  Проголосовать: нравится +6 Проголосовать: не нравится

»
5 часов назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Probem A

void solve(int T)
{
    int a, b;cin>>a>>b;
    if(a&1)a--;
    cout<<(b-a+1)/4 <<endl;
}
»
5 часов назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

I can't believe i solved B with relative ease but took 4-5 attempts for A, am I the only one who found A that hard? :(

If i was able to solve A rather quickly I would have probably solved Div. 2 C for the first time :(

»
5 часов назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

I have a very stupid question in problem C

Xa+yb = S
if(gcd(a,b)) == 1 
then there is a combination. 

but what if this combination has a negative number like X is negative then what ?

  • »
    »
    5 часов назад, # ^ |
      Проголосовать: нравится +1 Проголосовать: не нравится

    Read Hint 1. As it is mentioned, if you add $$$a$$$ or $$$b$$$ to all the elements except $$$c_i$$$, it is the same as decreasing $$$a$$$ or $$$b$$$ from $$$c_i$$$. So it doesn't matter if $$$X,Y$$$ are negative.

»
4 часа назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

nice set, liked Div1 A,B,C

»
3 часа назад, # |
  Проголосовать: нравится +6 Проголосовать: не нравится

LMydd0225 In Div1 D, when you rewrite the condition as $$$cnt(1,i)\geq cnt(\dots,n)$$$ should not be $$$k$$$ instead? and second, array $$$[k,1,k]$$$ doesn't fullfill $$$cnt(1,1)\geq cnt(\frac{k}{2}+1,k)$$$

»
86 минут назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Wow, I had a way different solution for E.

What I wrote was, if I calculated the distance from each (i) to (i mod n + 1) and store it in an array to[i]. and they're all unassigned (We need to know the number of unassigned edges on every path)

Then each time I would assign a value to an edge, I would remove 1 from to[x-1] and remove 1 from to[mx[x]] where mx[x] is the max number the subtree at x reached.

Now the answer is Sum of assigned edges * 2 + (W — Sum of assigned edges) * Number of paths with unassigned edges

I kept and updated the number of unassigned edges of all paths in a segment tree.