awoo's blog

By awoo, history, 7 months ago, translation, In English

2144A - Cut the Array

Idea: BledDest

Tutorial
Solution (BledDest)

2144B - Maximum Cost Permutation

Idea: BledDest

Tutorial
Solution (BledDest)

2144C - Non-Descending Arrays

Idea: BledDest

Tutorial
Solution (Neon)

2144D - Price Tags

Idea: BledDest

Tutorial
Solution (adedalic)

2144E1 - Looking at Towers (easy version)

Idea: Roms

Tutorial

2144E2 - Looking at Towers (difficult version)

Idea: Roms

Tutorial
Solution (BledDest)

2144F - Bracket Groups

Idea: BledDest

Tutorial
Solution 1 (awoo)
Solution 2 (awoo)
  • Vote: I like it
  • +50
  • Vote: I do not like it

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

is there any way to solve problem D in $$$O(n \sqrt{n})$$$, no right?

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

Problem E2 can be solved without any data structure more advanced than Fenwick tree (which supports increasing some value by $$$1$$$ and get a prefix sum of values).

$$$dp_i$$$ is the number of subsequences on prefix till $$$i$$$ such that the last element picked is $$$a_i$$$ and it's a record. Then $$$dp_i = \sum_{j \lt i: a_j = previousRecord} dp_j 2^{no. \ k: j \lt k \lt i, a_k \le a_j}$$$.

Let's introduce two arrays $$$le_i$$$ and $$$pr_i$$$. $$$le_i$$$ is the number of positions $$$j \le i: a_j \le a_i$$$ for $$$pr_i$$$ we would replace $$$a_i$$$ with the previous record.

Then $$$dp_i = \sum_{j \lt i: a_j = previousRecord} dp_j 2^{pr_i - le_j}$$$

$$$\frac{dp_i}{2^{pr_i}} = \sum_{j \lt i: a_j = previousRecord} \frac{dp_j}{2^{le_j}}$$$

So one can just maintain the sum of $$$\frac{dp_j}{2^{le_j}}$$$ for all records.

$$$le_i$$$ and $$$pr_i$$$ can be calculated with Fenwick tree.

338782926

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

    Hey Noobish_Monk, if you don't mind, could you explain this code ... only explaining the filling of pref[ ] part will be enough ( You can assume, I know Monotonic stack stuff, Fenweek tree and Coordinate compression ). Thank you!

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

For D:

First attempts. After fixing a value of x I tried to get the answer “almost in O(1)” — somehow compute the total new prices and the printing penalty in one go. In practice, without grouping items by their target price p, you keep losing track of what you’re adding to revenue vs. what you’re paying for extra labels. A full rescan over all items costs O(n) per x, which is too slow.

Think like a sieve. I remembered the Sieve of Eratosthenes: the work on step i is about N/i, so the total is N log N. Same philosophy here: on step x you process buckets — contiguous price ranges of width x. There are about A/x buckets. If you pre-aggregate once (prefix sums) so each bucket costs O(1), then the total over all x is A * (1/2 + 1/3 + …) = A log A. The analogy is simple: the sieve marks multiples; we “mark” contiguous ranges. In both cases, organizing work by natural groups gives you a harmonic series instead of chasing impossible O(1) per step.

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

$$$\log n$$$ is not real, it can't hurt you.

Got bit by it cause my solution for D was $$$O(n \cdot \log n \cdot \log n)$$$.

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

Title: Appeal: False Plagiarism Flag for Submission 338775909 (Problem 2144D) Hey MikeMirzayanov awoo adedalic Neon Roms BledDest, My handle is ishowguts. Submission 338775909 for problem 2144D was flagged as coinciding with submission 338766632, but I wrote all the code myself offline in VS Code with no collaboration. Development timeline & evidence: * First save: September 15, 2025 at 9:03 PM IST * Last save: September 15, 2025 at 9:54 PM IST * All file “last modified” timestamps in my local workspace reflect this period * I never uploaded or shared my code on any public IDE or platform during development * I implemented each function and logic block manually in this session 
Please manually review both my code and the other submission. If you need any more evidence, I am ready to provide it.awoo Thank you for your time and understanding.


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

    You are not fooling anyone. And, file stats can be spoofed. Your account is too new, and rising too fast. You submissions from previous contests are skipped too. So, stop spamming in each thread.

    P.S. I think CF should, optionally, allow linking to IDs on other CP platforms to prove authenticity.

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

      This is my 2nd I'd and for the authenticity part just check my codes and if you notice that something is fishy you can dm me or in the next contest maybe we can hop on discord call and solve the questions in front of you, so please don't comment without knowing the full picture and for the last skipped question i submitted the same code of my main account in this account as unrated at that time I didn't knew that even unrated contest also gets skipped, and when u check for official submissions ull not see any skipped submissions. Thank u.

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

        bro just quit it your code for E1 is basically unreadable almost no one other than some insanely high rated people write code like that, how hard is it learn some basics of CP and then give the contests honestly?

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

          1st of all u shut up i aint talking to you and please stop stalking my profile get a job lil nega, and for the learning basics for cp any day i can make a account and get to 1500-1600 easily and so please stay otta this

      • »
        »
        »
        »
        7 months ago, hide # ^ |
         
        Vote: I like it +4 Vote: I do not like it
        1. Alts are against the CF rules. Refer to https://mirror.codeforces.com/blog/entry/124418

        2. Really, dude? Did you look at both the submissions? All you did was rename some variables and make the formatting worse, somehow, and replaced '\n' with an endl.

        3. if(!(cin >> T)) return 0; what does this even do?

        4. The other account is clearly a temp account, probably made just to help others cheat.

        5. I see you have dabbled in several different programming languages. Python, C, Go, Rust, C++, etc.

        Why are you trying so hard on this lost cause? Did you want that Expert so bad?

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

          I understand the skepticism, but if I were truly trying so hard to reach Expert by cheating, I would have done so from the very beginning and not waited until now. Also, if I’d been cheating all along, I wouldn’t have been caught on just this one problem—especially since it’s not among the harder problems. My rapid improvement and this single false flag reflect automated detection quirks, not dishonest behavior.

          The line

          cpp if(!(cin >> T)) return 0; is a simple input guard to exit if reading T fails in custom tests.which many competitive programmers use, I spent ~50 minutes coding this solution (timestamps provided). Any similarity comes from the standard DP approach required here. I’m happy to share my full VS Code workspace metadata or do a live session to prove my process. I only ask for the manual review allowed by the appeal process.

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

          and for the alts account at that time i didnt actually knew that making 2nd id is prohibited as many of my uni friends had 2-3 ids at that time, and i did got banned for that particular reason and didnt raised my voice after i got to know

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

            Cheater don't need to explain.... It just makes you look like a joker.

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

Am I the only one who eventually came up with an O(N) solution for C, but doubted its correctness because N <= 100?

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

Was it just me, or did C feel a bit harder than D? C’s implementation looks straightforward, but the proof that dp[i] = 2 * dp[i+1] || d[i] = d[i+1] felt a bit tricky to reason out.

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

Why it take yall so long to post the editorial bruh im tryna get educated its an eeucational round twin

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

why c constraints so low if solution is so fast?? I was hoping to see a brute force solution. I like those.

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

I think there is typo in C editorial.. answer is 2^m.. where m tells number of type 1 pairs not number of segment of type 2 pairs.

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

My solution for E1 was slightly different than the one given in the editorial: 339030512

Is it possible to come to an optimization for E2's constraints using this E1 solution?

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

A bruteforce check can also pass F.

code

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

There is a typo in the solution of E1: calculaye -> calculate

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

Can someone help me with problem C, please?

Editorial of the problem C says, "Let's initially swap the elements in those pairs where ai>bi; the answer will not change (since the 2^n subsets of indices we are considering will yield the same results after such a transformation, just in a different order)."

Why will the answer not change if I initially swap the elements???? Editorial doesn't say anything about it.

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

    Wait, I think I have found something:

    We can develop a relation between the set of indices of original(before swapping) state and transformed(after swapping) state.

    T = S​ △ F

    Here:

    T = Any set of good indices of transformed array.

    S = Any set of good indices of Original array.

    F = set of swapped indecis.

    △ = Symetric Difference.

    and also: S = T​ △ F

    Let say we can find(let's say by brutforce) all the valid subsets of good indeces for the original arrays a and b, which will make the arrays a and b sorted. We are representing each of them by S.

    Now, after swapping all F indecis, the arrays a and b are now sorted in non-decreasing order. And now subset of good indecis is the one which will not make the array a and b unsorted. We are representing each of these subsets of indecis by T.

    Now see the following example: Let, a = [2, 1, 3, 5, 4]

    b = [1, 3, 3, 4, 6]

    Here, F = [1 4]

    After swapping index 1 and 4:

    a = [1 1 3 4 4]
    
    b = [2 3 3 5 6]

    Let S = {1,3,4}, a set of good indices for original arrays a and b.

    According to the relation: T = S​ △ F

    = {1,3,4} △ {1, 4}

    = {3}

    So, T = {3} is a good subset of indecis for transformed arrays a and b. If we just swap the index 3 in transformed arrays a and b, it will not change the sorting order of the transformed arrays a and b. So for each valid subset of good index of original array a and b, we will find a valid index for the transformed a and b.

    We can also go back from transformed subset of index to original subset of index. Let say we have a valid subset of good index for transformed a and b, and that is T = {3}. Now we want to know what the original good subset of index for this one is:

    S = T​ △ F
      = {3} △ {1, 4}
      = {1,3,4} 
      = this is an original good subset of index.

    So if we can just find number of good subset of indeces of the transformed a and b, that will be the answer.

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

Nice Round,so much useful tricks!

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

:/

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

Does Anyone have the tutorial for the solution of 2144C - Non-Descending Arrays using dynamic programming?

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

I have a few questions about C editorial. It's stated that "the answer is $$$2^m$$$ , where m is the number of segments of type 2 pairs.", but I think it's misleading as single type 1 pair is independent and can contribute to the result with $$$*2$$$ multiplier, so it's not only about type 2 segments? I don't quite understand the explanation for $$$2^{n-k}$$$ (merges), but the inverted calculation in solution code is more explanatory: $$$2^{k+1}$$$, where extra $$$1$$$ power is for the starting position (we can choose any order) and $$$k$$$ here is the number of such $$$i$$$ such that $$$a_i \geq b_{i - 1}$$$ (we can choose any order for $$$i$$$ position, but subsequent $$$i+1$$$ if it's type 1 pair is dependent on this chosen order and must adapt accordingly, we have no freedom there).

Also, is the following reasoning for "the answer will not change (since the $$$2^n$$$ subsets of indices we are considering will yield the same results after such a transformation, just in a different order)." part correct: we assume that all swaps start from ordered state (all $$$a_i \leq b_i$$$) and answer uniqueness rely on that if there are two swaps for the same position in the end, the result is that there were no swaps performed for $$$i$$$, i.e. the thing that we performed some operations at the beginning doesn't matter because we can revert them and this leads to same answer count?

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

For C, what about the case when a = 4 3 b = 5 7

Then there is no subset of indices after which the array would be in non descending order, but you say a subset would always exist how?