Getaway_Car's blog

By Getaway_Car, 4 hours ago, In English

Thank you for participating in the round!

Fun facts
Rate this round

2277A - Subset Selecting

Author: Getaway_Car

Hints
Tutorial
Code
Rate the problem

2277B - Sequence Decreasing

Author: Getaway_Car

Hints
Tutorial
Code
Rate the problem

2277C - Edge Addeleting

Author: _O_v_O_

Hints
Tutorial
Code
Rate the problem

2277D1 - Number Operating (Easy Version)

Author: Getaway_Car

Hints
Tutorial
Code
Rate the problem

2277D2 - Number Operating (Hard Version)

Author: Getaway_Car

We'd like to thank RockyYue for providing an optimized solution.

Hints
Tutorial
Code
Rate the problem

2277E - Tree Guessing

Author: _O_v_O_

Hints
Tutorial
Code
Rate the problem

2277F - Token Re-Moving

Author: Getaway_Car

Hints
Tutorial
Code
Rate the problem
  • Vote: I like it
  • +16
  • Vote: I do not like it

»
4 hours ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by Getaway_Car (previous revision, new revision, compare).

»
4 hours ago, hide # |
 
Vote: I like it +20 Vote: I do not like it

if D1 was b then it is not fun fact but horror fact :p

»
4 hours ago, hide # |
 
Vote: I like it -39 Vote: I do not like it

I feel like d1 was a bit easier compared to most other div2 d's. Nice round tho!

»
3 hours ago, hide # |
 
Vote: I like it +17 Vote: I do not like it

Why is problem E and F easier than problem D

»
3 hours ago, hide # |
 
Vote: I like it +6 Vote: I do not like it

D2 is much harder than E...

»
3 hours ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

I wish I could participate but gotta study bio for my bio exams in 2 weeks :/

»
3 hours ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

I don't like trees, so I skipped C and went straight to D, only to get stuck there :(

»
3 hours ago, hide # |
 
Vote: I like it +2 Vote: I do not like it

I had studied but still able to solve till C...!!

»
3 hours ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

fast editorial!

»
3 hours ago, hide # |
 
Vote: I like it +11 Vote: I do not like it

A is damn hard...

»
3 hours ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

speedblitz edu :O

»
3 hours ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

fast editorial!!

»
2 hours ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

in q c. i did by using dsu path compression as i dont know how to do binary uplifting. we can obervse that any node say x then if x and n have lca other than 1 it can make path longer . so if their lca is not 1 its useful to us.so i use dsu path compression to store par of everyone either its 1 or other (i stored a path from 1 to n in a set and now i stored everyone par as 1 of member of this set) now. for every vertex that we are given to explore. i just see if the par is not 1. then just used that formula . 1+depth(n)-2*depth(common lca)+depth(j).its not the best approach but i am happy first time i solved q. c in contest.

  • »
    »
    2 hours ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    There exists an easier method as well using DFS.

    • »
      »
      »
      111 minutes ago, hide # ^ |
       
      Vote: I like it 0 Vote: I do not like it
      Spoiler
»
2 hours ago, hide # |
← Rev. 2  
Vote: I like it 0 Vote: I do not like it

could anyone tell me whats wrong with my solution for A 395842509

»
2 hours ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Problem B is confusing. First the problem says, "3. choose one element of this subarray and remove it from b, without changing the order of the remaining elements."

And then in the 4-th testcase, 5 // 2 1 1 0 3 the output is 5. The tutorial assumes that we only can reduce the elements and skip the removal part! What's going on?

NOTE: I can be wrong, please explain your point simply! Tnx!

  • »
    »
    105 minutes ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    We can show that 5 works here; by choosing entire array, our first operation can be solely the final element which makes the array 2110 (since 3 is removed), from there we can choose [1,3] at whcih the array can be 000 since it goes 2110->1000->000. I think this is how it might go?

    • »
      »
      »
      100 minutes ago, hide # ^ |
       
      Vote: I like it 0 Vote: I do not like it

      According to the output requirements: "output a single integer — the maximum length of a good subsequence of a, or 0 if no such subsequence exists", shouldn't the ans be 3 instead? Then to all those people who solved it, how did they knew the question has errors?

      • »
        »
        »
        »
        94 minutes ago, hide # ^ |
         
        Vote: I like it 0 Vote: I do not like it

        No the answer is 5. Maximum length is number of elements in the longest subsequences that is good, NOT the largest value of a good subsequence. The question did not have error(s).

  • »
    »
    103 minutes ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    They haven't specified the size of the subarray we have to choose in the qs. So since there is already a 0 present in the subarray, we can just take our "good" subsequence as 2 1 1 0 3 and then perform 4 ops on each of the individual elements.

    Take [2] for instance, after 1 op it becomes [1] but we have to remove one element also so it becomes []. Do this for all the other ai > 0. so our final array is just [0]

    We can just extend this idea to the case where we don't have a 0 at all in the array. In general if theres at least one element <= n — 1, we can make the whole array "good".

  • »
    »
    101 minute(s) ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    I mean, one could only reduce an array's size after removing some elements from it?

    For the testcase, You can select the full array as a sub-sequence and test if it's good or not.

    [2 1 1 0 3] For making this good, select the [2 1 1] as a subarray and do the subtractions, becomes: [1 0 0] and remove an element, let's remove 1 becomes: [0 0] + [0 3] = [0 0 0 3]

    Then select [3] as a subarray, decrement to get [2] and remove an element to get []

    [0 0 0] + [] = [0 0 0] As you can see, we have boiled the array down to a non-empty array consisting purely of zeros. So this subsequence is good and because it is the largest subsequence, it is also the answer.

    To make the process easy, you could start by asking:

    Spoiler
  • »
    »
    89 minutes ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    Take the whole array, reduce it to good array and read the problem statement again. Thank you.

  • »
    »
    45 minutes ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    The question is weather this array can be transformed into an array consisting of only zeros or not even if after removing everything and only 1 zero this means that the size of current array is the answer in the example you showed we can remove every element and leave the 0 and that would mean we made it from this array to an array with '0' so this array of size 5 is valid, sorry if i don't make sense you should re-read the problem that might help

»
114 minutes ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

I am too weak :(

»
103 minutes ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

My solution discussion stream for ABCD1E

»
102 minutes ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

My Question to the people who were able to do D1:

How can you be sure during the contest that these two ways were sufficient, and there is no other way of 0 -> (operations) -> n, which gives a more optimal answer ?

Based on my prior experiences, whenever I find two ways of doing a thing and drawing cases show that for some cases first way gives correct answer and for some cases the second way, the general tendency of mine is to take the best of these two ways just to get a WA on test 2. Unfortunately, I did not even try minimising both definitions of f(n) i wrote, during the contest, and later found out that it was indeed the optimal solution.

  • »
    »
    67 minutes ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    Wait that was intended, i took a completely different path than yours that requried way more guessing. My subimission:395865736

»
96 minutes ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

in D1 i mistakenly read it as (where k is the number of type 2 operations you have performed before) so i just got stuck then i read F and i thought on it got a very long implementation solution started implementing but got time out.

»
57 minutes ago, hide # |
← Rev. 2  
Vote: I like it 0 Vote: I do not like it
D1 alternate sol (much more complicated, slower, and uglier)