ko_osaga's blog

By ko_osaga, history, 8 months ago, In English

Thank you for your participation!

Problem A, B were authored by djm03178.

Problem C was authored by middle_man.

Problem D was authored by qwerasdfzxcl.

Problem E, F, G, H1, H2 were authored by ko_osaga.

2152A - Increase or Smash

Spoiler
Code

2152B - Catching the Krug

Spoiler
Code

2152C - Triple Removal

Spoiler
Code

2152D - Division Versus Addition

Spoiler
Code

2152E - Monotone Subsequence

Spoiler
Code

2152F - Triple Attack

Spoiler
Code

2152G - Query Jungle

Spoiler
Code

2152H1 - Victorious Coloring (Easy Version)

Spoiler
Code

2152H2 - Victorious Coloring (Hard Version)

Spoiler
Code
  • Vote: I like it
  • +275
  • Vote: I do not like it

»
8 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

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

»
8 months ago, hide # |
 
Vote: I like it +10 Vote: I do not like it

Thanks for the fast editorial and the amazing contest :)

»
8 months ago, hide # |
 
Vote: I like it +13 Vote: I do not like it

Except for B>C, it was a beautiful contest...

  • »
    »
    8 months ago, hide # ^ |
    Rev. 2  
    Vote: I like it -13 Vote: I do not like it

    C was easy than B.

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

    bro how u check that there is a pair of same 0 or same 1 or not in a subarray

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

      node of segment tree will contain two variables (left and right) -> on merging check if either of the two subpart already have the adjacent element(i.e two consecutive 1's or 0's) or their left subarray's(right) and right subarray's(left) can make it.

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

      if we find the subarray to be alternating 0 and 1 or not, we can answer your question. Construct a dp which says for each index maximum length till which the sequence is alternating from that index.Then checking if index + dp[index]-1>=r or determines answer to your question, (subarray is [index,r])

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

      Use a set s for all indices 1<=i<n for which a(i)==a(i+1); then for some given l and r we can use s.lower_bound(l); This returns the pointer to an idx>=l => if this is not end pointer and value at this pointer is < r => you have a adjacent pair from l to r

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

    Really?

»
8 months ago, hide # |
 
Vote: I like it +79 Vote: I do not like it

B is my nightmare

»
8 months ago, hide # |
 
Vote: I like it +23 Vote: I do not like it

Thank you all for participating! For fun, here are one-liner (except for inputs) python solutions for 2152A - Increase or Smash and 2152B - Catching the Krug. Although problem B turned out to be harder than my intention (but I'm glad that $$$1500$$$ points worked!), I hope you still enjoyed the problems!

A. Increase or Smash
B. Catching the Krug
  • »
    »
    8 months ago, hide # ^ |
     
    Vote: I like it +21 Vote: I do not like it

    Every unsolved problem teaches us.

  • »
    »
    8 months ago, hide # ^ |
     
    Vote: I like it +65 Vote: I do not like it

    If you want to be a try-hard at codegolfing, you can technically solve them in 1 line (including input reading).

    A
    B
    C
»
8 months ago, hide # |
 
Vote: I like it +11 Vote: I do not like it

Great problems!

»
8 months ago, hide # |
 
Vote: I like it +2 Vote: I do not like it

First time tried D before C for more points and I hate myself. Waiting for intuition of D... Was sure it was about log2

»
8 months ago, hide # |
 
Vote: I like it +11 Vote: I do not like it

Such contest might make me drop a lot,go and learn binary search

»
8 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

For problem-B, Is it true that Doran always catches Krug in atmost 'n' moves even for worst possible case?

»
8 months ago, hide # |
 
Vote: I like it +145 Vote: I do not like it

F be like

Great problem by the way !

»
8 months ago, hide # |
 
Vote: I like it +8 Vote: I do not like it

Thanks for the great contest :)

»
8 months ago, hide # |
Rev. 2  
Vote: I like it 0 Vote: I do not like it

For problem D, could someone explain why Poby and Rekkles are always able to find fresh "B"'s in their strategies? What if the array is (8, 8, 9), then one of them touches 9, then the other two elements are type A...

  • »
    »
    8 months ago, hide # ^ |
    Rev. 2  
    Vote: I like it 0 Vote: I do not like it

    I think it happens only when possible ( If Poby just first-touched a fresh B, Rekkles first-touches another fresh B when possible). And B's will have priority as they are the inflection points.

  • »
    »
    8 months ago, hide # ^ |
    Rev. 4  
    Vote: I like it 0 Vote: I do not like it

    Type A have no problem, because Rekkles has to make a number 2^n into 2^n + 2 to be able to increase the number of moves by 1. But as soon as he increases it by 1, Poby will be making it again of the form 2^m by dividing by 2 and Rekkles has to increase it again by 2.

    but if it is of the form 2^n + 1 in the start, then Poby can save atmost half of them, because if he saves 1 by dividing by 2, Rekkles makes another one of the form 2^n + 2.

    any other number will be atleast of the form 2^n + 2 .... which will be eventually reduced to 2^m + 1, Rekkles will make it again atleast of the form 2^m + 2. So Poby cant save any of these numbers from Rekkles.

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

      Why Rekkles want the number to be of the form 2^n + 2?

      because when it will be reduced to 2^m + 1(m=n-1), Rekkles will again make it 2^m + 2

      and so on until it reaches 3(2^1 + 1), and Rekkles will make it 4. so it increases the move count by 1.

»
8 months ago, hide # |
Rev. 2  
Vote: I like it 0 Vote: I do not like it

UPD: Found the issue, Thanks to djm03178

»
8 months ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

My Solution for E using DAG 341753535

Would be great if someone could prove why it works

Basically, I tried to build a DAG using the queries where each index is a node and edges point from index with smaller value to index with greater value. Then find a path of length n + 1 such that indices on that path are monotonically increasing or decreasing. I'm not sure why a path of length n + 1 always exists in this DAG.

  • »
    »
    8 months ago, hide # ^ |
     
    Vote: I like it +5 Vote: I do not like it

    As far as I understand that's what the editorial does, transitions in $$$dp$$$ can be viewed as a path in a DAG, though I might be mistaken.

    This graph is literally all relations between elemenets which you can get with queries, so it will cover some construction which always appears. That construction is as follows:

    there will be 1 element left. Then look at the records from queries in reverse order, and at each step pick the record closest to current element which is to its left. The DAG contains this path.

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

      What do u mean by “there will be 1 element left”?

      • »
        »
        »
        »
        8 months ago, hide # ^ |
         
        Vote: I like it +5 Vote: I do not like it

        The one which isn't a record in any of the queries (since there are $$$n^2 + 1$$$ and each query covers at most $$$n$$$)

        • »
          »
          »
          »
          »
          8 months ago, hide # ^ |
           
          Vote: I like it +8 Vote: I do not like it

          Ohh right. If some query returns more than n indices then that would be the answer, and if not, then your construction would be present.

          Awesome proof, thanks :)

»
8 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

My solution for F 341757812
Brute forced the possible states. Start with all {i, i+1} and add state {i+1, pos}, where {i, i+1, pos} is the most optimal pair. Could not find a bound on the number of states but somehow it works!

»
8 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

People who are not good at game theory:

A: 495 0:04

B: 1236 01:06

C: 1176 01:21

D: -2

»
8 months ago, hide # |
 
Vote: I like it +13 Vote: I do not like it

Why no stronger samples TAT

»
8 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Would someone like to share how they came up with the intuition for problem D? Thanks.

  • »
    »
    8 months ago, hide # ^ |
    Rev. 9  
    Vote: I like it +19 Vote: I do not like it
    • first understand that once a element becomes a power of 2, it cannot contribute anymore to increase in no of poby operations. it gives us a base that max answer could be
    $$$\sum_{i=l}^{r} \left\lfloor \log_{2} a_i \right\rfloor + (r-l+1).$$$
    • lets assume rekless wont add +1 to the same element twice, making it +2. it just becomes complex.
    • ignore the power of two elements they are of no use
    • now the main strategy that helps is, what happens if rekkless adds a +1 to the same element poby floor divided. will that strategy ensure that we can get maximum answer ?
    • happens that there are two types of elements, type1 where if rekkless keeps adding a +1 "after" the floor division, it can provide a +1 to the answer. so type1 elements always contribute to answer with "+1", as rekkless can simply add +1 to any element poby floor divides. poby can do nothing about it and its pre determined.
    • type2 where rekkless has to keep add a "+1" before poby floor divides it. if the first operation on such elements is floor division, they become useless, instead if its a "+1" operation they convert into type1 elements.
    • so the initial strategy for poby is to get rid of as many type2 elements by floor divinding them once and making them useless for further, and so for rekkless is to do +1 to as many elements type2 and converting them into type1 elements.
    • so rekkless can force the game to always achieve
    $$$\sum_{i=l}^{r} \left\lfloor \log_{2} a_i \right\rfloor + \text{type1 in } [l,r] + \left\lfloor \frac{\text{type2 in } [l,r]}{2} \right\rfloor

    $$$
    • we can see that "+2" case is not needed in a optimal sequence of moves.
»
8 months ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

B is unexpectedly difficult. but i finally solve it. E is expectedly difficult. but i don't solve it untill end. ;(

Can anyone share how to think of solution of E ?

  • »
    »
    8 months ago, hide # ^ |
     
    Vote: I like it +3 Vote: I do not like it

    Take a look at my editorial for problem E.

    (Initially I wrote it as a comment here, but Codeforces blocked me from posting it, saying "The comment contains source code without markup." So I put it in my blog...)

»
8 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Reached Master with this contest, thanks for the amazing A-E and brute-force-able F :)

»
8 months ago, hide # |
Rev. 2  
Vote: I like it 0 Vote: I do not like it

Why does my code works? Can anyone explain? code:problem D

I basically divided initial v[i]s based on who act first on that element. I calculated #ops it takes to make it 1, by starting from v[i] (first op made by player A) and by starting at v[i]+1 (first op made by player B). This way, I calculated what all v[i] take +1 extra operation when player B act first on it.

Then result of [l,r] is = orignal #ops + cnt/2, where cnt is total number of v[i]s where you have chance to increase operation by +1 if player B starts first.

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

    why cnt/2 shouldn't it be cnt — 1 as for all the v[i] B will act first and increase value by 1 except in the starting case as A has to make the first move

»
8 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

New Problem Suggestion as C2 : Triple Removal (Hard Version)

In this version of the problem there will be 2 kinds of queries

  1. 1 l r : To find minimum cost for the array [al,...,ar]

  2. 2 i : Flip the bit at index i (i.e set a[i] = a[i]^1) (Point update)

I got this idea while solving C using segment tree

My solution for C : https://mirror.codeforces.com/contest/2152/submission/341788525

Inspired solution for the new version of the problem —

Node Structure
Solution

Please let me know if there exists an easier solution for this

  • »
    »
    8 months ago, hide # ^ |
    Rev. 2  
    Vote: I like it 0 Vote: I do not like it

    I think such complicated node structure is not required simple version of fenwick tree works here

    define index $$$BIT[i]$$$ = 1 if $$$s[i] == s[i - 1]$$$ else $$$0$$$ Find segment sum and check if its positive for checking alternating in a segment and then we can do point updates by carefully update the value at $$$i$$$, and $$$i + 1$$$ indices after flipping $$$i$$$.

    • »
      »
      »
      8 months ago, hide # ^ |
      Rev. 4  
      Vote: I like it 0 Vote: I do not like it

      For checking is subarray alternating (with flip bit update), we can use only std::map<int, int>.

      But problem with counting $$$0$$$ and $$$1$$$ in range — btw it possible to solve with ordered_set.

      Spoiler
»
8 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

I hate that i dont get problem D. how do people even solve it?

»
8 months ago, hide # |
 
Vote: I like it -13 Vote: I do not like it

Problems like B shouldn't be given in a contest.

»
8 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

The scores of H1 and H2 should be swapped.

»
8 months ago, hide # |
 
Vote: I like it +8 Vote: I do not like it

Naturally come up with a link-cut-tree solution for G.

code

»
8 months ago, hide # |
 
Vote: I like it +16 Vote: I do not like it

There is in alternative solution for F.

I used a similar method to the one listed in the tutorial using jump pointers but with a different transition states. Each state is a pair (a,b) where b is the current most right index, and a is the previous index. There is a special case with a==-1, which means that we are free to find the next index. (a,b) transitions to (b,c) where c is the first element with x[a] + z < x[c]. This can be found using binary search. We start by computing all transitions for (-1,i), and transitions from states that follow. I don't have a proof for it but we should visit O(n) states in total. The we do jump pointers and for each query move from (-1,l)

Example solution https://mirror.codeforces.com/contest/2152/submission/341761304

  • »
    »
    8 months ago, hide # ^ |
     
    Vote: I like it +6 Vote: I do not like it

    Bro, you're not alone! I also came up with a very similar idea. Here's the formal proof for its complexity and an argument for why this approach is arguably more elegant than the editorial's.

    My implementation is slightly different: I start from pairs $$$(i, i+1)$$$ (using 0-based indexing) and a sequence terminates when it generates an invalid pair like $$$(i, n)$$$. You can see my submission here: 342191794

    The proof of $$$O(n)$$$ states

    The key claim is that the total number of unique pairs $$$(i, j)$$$ generated is bounded by $$$\sim 4n$$$. My solution gets RE with a buffer of $$$3N$$$ for the states, but gets AC with $$$4N$$$. Let's formalize the model. Let $$$f(i)$$$ be the function from the editorial: $$$f(i) = \min {(j | j \gt i, x[j] \gt x[i] + z})$$$. Our state transition function is $$$g((i, j)) = (j, max(j + 1, f(i)))$$$. The entire solution explores a functional graph where states are pairs $$$(i, j)$$$ and edges are defined by $$$g$$$. To prove the linear bound, we can split the array $$$x$$$ into blocks, where a block ends at index $$$k$$$ if $$$x[k+1] - x[k] \gt z$$$.

    Counting "boundary crossing" pairs ($$$\sim 1n$$$ states)

    When a transition crosses from block $$$B_k$$$ to $$$B_{k+1}$$$, the new pair is always $$$(L, R)$$$ where $$$R$$$ is the first element of $$$B_{k+1}$$$, and $$$L$$$ is some element from $$$B_k$$$. The number of such pairs is at most the sum of sizes of all blocks except the last one: $$$n - |B_{last}|$$$. Also I use invalid $$$(i, n)$$$ pairs in my implementation. Note that the index $$$i$$$ here must be taken from $$$B_{last}$$$. The number of these pairs is at most $$$|B_{last}|$$$. Summing these two gives $$$(n - |B_{last}|) + |B_{last}| = n$$$. So, all "boundary crossing" transitions generate at most $$$n$$$ unique states in total.

    Counting "in-block" pairs ($$$\sim 3n$$$ states)

    Consider the chain $$$(i, i+1) \to (i+1, f(i)) \to (f(i), f(i+1)) \dots$$$ Note that the chain is correct because $$$f(i) \gt i + 1$$$, because $$$x_{f(i)} \gt x_i + z$$$ by definition, and $$$x_{i+1} \le x_i + z$$$ because $$$i$$$ & $$$i + 1$$$ are in the same block, and $$$x$$$ is monotonous.

    Let's now split all the pairs into $$$3$$$ groups and count them.

    Type 1: Base pairs $$$(k, k+1)$$$. There are $$$n-1$$$ of them.

    Type 2: First-jump pairs $$$(k+1, f(k))$$$. Each base pair generates one of these. $$$\sim n$$$ states.

    Type 3: Synchronized-jump pairs $$$(f(k), f(k+1))$$$. Their number is also $$$\sim n$$$, because we have them for $$$k = 1 \dots n-1$$$

    Together, these account for $$$\sim 3n$$$ states within the blocks.

    Summing up the boundary states ($$$\sim 1n$$$) and in-block states ($$$\sim 3n$$$), we get the total bound of $$$4n$$$ states.

    Why this approach is more unified than the editorial's

    The editorial's solution feels a bit hacky. Our solution is more elegant because it's unified. There is only one mode of operation: We precompute a single graph of states $$$(i, j)$$$. The logic of path merging (the LCA part) is implicitly baked into our graph structure — the transition to $$$(LCA, LCA + 1)$$$ in author's solution is the transition from one block to another in our solution: Let's see: $$$[\dots i \dots j \dots] \;\;\; [x \; y]$$$, where $$$i$$$ and $$$j$$$ — some elements of the left block, $$$x$$$ & $$$y$$$ — the first 2 elements of the right block (for simplification, we consider only $$$|B_{right}| \ge 2$$$). The equation $$$f(x) = f(y)$$$ (going to LCA) is equivalent to the transition $$$(i, j) \to (j, x) \to (x, y)$$$.

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

      How does this work? We can compute the chain one step further, giving $$$(k, k+1) \to (k+1, f(k)) \to (f(k), f(k+1)) \to (f(k+1), f(f(k))).$$$ It's not obvious to me why $$$(f(k+1), f(f(k)))$$$ is in one of the three categories you proposed, and I'm pretty confident I can find a counterexample.

»
8 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it
»
8 months ago, hide # |
 
Vote: I like it +10 Vote: I do not like it

H1 is able to solved by in O(nq) time using tree DP.

»
8 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Alternate sqrt solution for F:

  • Define $$$\text{nxt}(i)$$$ to be the smallest $$$j \gt i$$$ such that $$$a_i + z \lt a_j$$$.
  • Notice that greedily building the subsequence from left to right is optimal for every query (ie. start with $$$S = [l, l + 1]$$$, then at every step, let $$$x$$$ and $$$y$$$ be the second last/last elements in $$$S$$$, and we add $$$\max(\text{nxt}(x), y + 1)$$$ to $$$S$$$. We do this until the index to be added remains $$$\leq r$$$).
  • Divide the array into blocks of size $$$B$$$.
  • For every pair of indices $$$i, j$$$ $$$(i \lt j)$$$ belonging to the same block $$$b$$$, precompute (a) the state it ends up at upon first exiting this block if we enter with state $$$(x = i, y = j)$$$ (b) the number of jumps required to do so. All of this can be done in $$$O(B^2)$$$ per block, and thus takes $$$O((n/B) \cdot B^2)$$$ time in total.
  • For every query $$$l, r$$$, start with $$$x = l, y = l + 1$$$, and until $$$y \leq r$$$: (a) if $$$x$$$ and $$$y$$$ lie in the same block and $$$r$$$ doesn't lie in the same block, use the precomputed info to jump out of this block in $$$O(1)$$$ (b) otherwise manually make $$$x$$$ jump to $$$\max(\text{nxt}(x), y + 1)$$$ in $$$O(1)$$$. We can prove that this process terminates within $$$O(n/B)$$$ iterations, so we answer each query in $$$O(n/B)$$$ time.

A poor implementation of this idea can be found here. Unfortunately, accessing the precomputed information is horribly cache-unfriendly to the point where I don't think this can be made to pass.

»
8 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

I was a pupil in this test.

»
8 months ago, hide # |
Rev. 2  
Vote: I like it 0 Vote: I do not like it

Alternate linear solution for H1:

Let's try to solve the problem for a single query with value $$$l$$$. We root the tree at node $$$1$$$.

Observation 1: Any optimal selection of red nodes forms a connected component.

Proof

Observation 2: For any leaf $$$u$$$, it's optimal to assign it a weight of $$$\max(0, l - y)$$$, where $$$y$$$ is the weight of the edge from $$$u$$$ to its parent.

Proof

Let's extend this idea further. We'll assign weights to vertices in a bottom-up manner (so when assigning $$$w_u$$$, $$$w_v$$$ for all children $$$v$$$ of $$$u$$$ would already have been assigned).

Some definitions:

  • $$$S(u, v)$$$ — a set of red nodes with the minimum cost which contains $$$u$$$ but not $$$v$$$
  • $$$C(u, v)$$$ — the cost of $$$S(u, v)$$$.
  • $$$p_u$$$ — the parent of u.
  • $$$g(u, v)$$$ — the weight of the edge $$$(u, v)$$$.

For every $$$u$$$, we will compute $$$C(u, p_u)$$$, where $$$p_u$$$ is the parent of $$$u$$$. It's not difficult to see that:

$$$C(u, p_u) = g(u, p_u) + w_u + \sum_{v \in \text{children}(u)} (\min(g(v, p_v), C(v, p_v) - g(v, p_v)))$$$

(for every child $v$, we choose to either take the cost of the optimal component from below, or that of just the edge)

Observation 3: It's optimal to assign node $$$u$$$ a weight of $$$\max(0, l - g(u, p_u) - \sum_{v \in \text{children}(u)} (\min(g(v, p_v), C(v, p_v) - g(v, p_v))))$$$ (define $$$g(1, p_1)$$$ to be $$$0$$$).

Proof

This works in $$$O(n)$$$ per query and ends up being very easy to implement.

»
8 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

I’m really sorry to post this here, but I need some help. In this contest, my main account rJ_ysenM was banned immediately after my first “skip”. I believe it’s a mistake because I did not cheat or engage in any suspicious behavior. In fact, I even ran the problems through several AI language models and got totally different solutions from mine.

I understand that skipping some easy problems and go solve harder problems right away can look suspicious, but if you review my contest history, you’ll see I only do that in topics I’m deeply familiar with (primarily graphs and combinatorics).

I realize you may have strict anti-cheat measures in place, which is why I’m reaching out directly now. I’ve already contacted Mike but haven’t heard back, so a friend suggested I try here or reach out to KAN (which i also did but i know both of them are busy)

I was so close to reaching Master and I’d really appreciate any help restoring my account. Thank you for your time, and sorry again for any inconvenience.

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

I have an alternative solution for H1:

Spoiler
»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

I bet the question setter is a T1 fan

»
7 months ago, hide # |
Rev. 2  
Vote: I like it -8 Vote: I do not like it

even the first problem felt difficult to me....

»
6 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Is C proof complete?

This part seems not to be strict or detailed enough. "Suppose that there are two indices i,j such that $$$c_j\geq2,0 \lt i \lt 3k,0\leq j\leq 3k$$$ , and $$$i \ne j$$$ . Then it is possible to perform the operations of cost 1 to remove every 0 s between $$$i$$$ -th 1 and $$$(i+1)$$$ -th 1 . "

How can we be sure that it won't lead to this situation? "Otherwise, $$$c_1=c_2=...=c_{3k-1}=1$$$ and $$$c_0,c_{3k}\leq1$$$ . In this case, every pair of adjacent elements in $$$[a_l,a_{l+1},...,a_r]$$$ is different."

Is it because we can remove 0s between i-th 1 and i+1th 1, ending up with reversed situation (now 11 are adjacent which can be used to produce another 00 pair (after removing that 11)?)

»
5 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

I think any1 who played chess knows the problem B,it is quite similar as the single rook checkmate

»
4 months ago, hide # |
Rev. 5  
Vote: I like it 0 Vote: I do not like it

I'm struggling to understand D explanation. I suppose Poby's (P) strategy first move is to start with B type element and respond to Rekkles (R) as described. I agree that strategy concerning B is optimal. But why is it optimal for both sides to apply operation for the most recently selected index? For one element, it's clear, but when players have more options, can't it be more beneficial for them to choose other numbers? I don't think the proof provided is strict. I understand that R has to react when number is 2^k+1 as it's the moment, when it can make the answer worse for P, but it's not every turn that x is of shape 2^k+1 (unless he will run out of good moves and will be forced to +1 earlier). I checked empirically that R moves doesn't make a difference for P in other cases.

To add up to editorial, worse one-time jump $$$\lfloor\frac{x+2}{2}\rfloor$$$ doesn't increase the initial answer (we can treat floor f(x) transformed to f(x+1) because of idleness and notice that the answer changes when transitioning from 2^k (=k) to 2^k+1 (=k+1), but when x is of B type, it should be 2^l+1=2^k, which is possible only for l=0). This as well means that P could not worry about R increasing index until it reaches from 2^{k} + 2 (=k+1 moves) to 2^{k+1} + 1(/=2 leads to k+1 total), so for R it could be counter-productive to raise this index any further, it's better to ignore it and focus on others. Also it was strange to see lemma for (+1, /2) operations at first, not vice-versa (reversed actions), but later it was clear why it's needed.

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

Problem B is great!