awoo's blog

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

Neapolis University Pafos

Hello Codeforces!

The series of Educational Rounds continues thanks to the support of the Neapolis University Pafos.

On Nov/28/2025 17:35 (Moscow time) Educational Codeforces Round 185 (Rated for Div. 2) will start.

This round will be rated for the participants with rating lower than 2100. It will be held on extended ICPC rules. The penalty for each incorrect submission until the submission with a full solution is 10 minutes. After the end of the contest, you will have 12 hours to hack any solution you want. You will have access to copy any solution and test it locally.

You will be given 6 or 7 problems and 2 hours to solve them.

The problems were invented and prepared by Adilbek adedalic Dalabaev, Ivan BledDest Androsov, Maksim Neon Mescheryakov, Roman Roms Glazov, Maksim FelixArg Novotochinov and me. Also, huge thanks to Mike MikeMirzayanov Mirzayanov for great systems Polygon and Codeforces.

Good luck to all the participants!

UPD: Editorial is out

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

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

as a contestant, i woke up like a sleeper agent at the sight of 6 or 7 problems

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

As a commenter, I commented very fast again!

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

as a contestant am searching for the tester's comment

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

As a contestant, i am waiting for this contest to start

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

where is score distribution?

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

676767676767676767676767676766767676767676767676767677667767676767676767667

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

No more weak pretest please:)

Btw, hope to solve at least 3 problems, thus increase my rating.

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

Hope to rank up!

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

Is there an interactive problem??

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

As a newbie on codeforces , I will try my best to solve some questions from this contest .

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

first contest

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

six xor seven

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

I hope problem B is not 2D problem

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

Nice B

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

that was tough :/

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

Ok, got it. E was a little easier than D ,but how more than 1k people got AC -_- ??????

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

There seem to a lot of cheaters in this round

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

How can one become master in this economy. Please do the needful by removing cheaters at the top.

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

    i think if you are smart enough to rewrite gpt solutions in your coding style instead of just changing variables, you are likely not getting caught. the best you can do today is have fun solving contests

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

terrible D

»
5 months ago, hide # |
Rev. 2  
Vote: I like it +12 Vote: I do not like it

Spent entire time debugging problem D edge cases. Always seems like a waste of a competition when you spend more time debugging than actually thinking about or solving problems.

Would be nice if they showed failures on test cases (maybe not all test cases but first 5 would be nice) you still get punished for your submission failures, but it also distinguishes between competitors who can solve the problem but are missing edge cases, vs competitors who flat out can't solve the problem. Always hate getting batched in the same ranking as the group who can't even attempt to solve a problem, when i can make a single tweak to solve a problem right after the contest.

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

this is way too hard for me

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

In problem C, i tried to sort both arrays, then, considering each index i, if (r[i]+1]*q[i]+r[i]<=k then it counts as a correct pair. Idk where im wrong, hlep :D

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

    sort quotients increasing, remainders decreasing.

    Here's where you fucked up. If you can't match a remainder to the lowest remaining quotient, you discard the high remainder but don't discard the low quotient.

    keep track of your quotient index. Then iterate through your remainders (largest to smallest) if you have a match, increase your quotient index and add to answer, otherwise do nothing

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

      "Here's where you fucked up. If you can't match a remainder to the lowest remaining quotient, you discard the high remainder but don't discard the low quotient."

      Initially was doing same but dk why i sorted both in increasing order lol..XD

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

      Could you please provide an example of this?

      • »
        »
        »
        »
        5 months ago, hide # ^ |
        Rev. 2  
        Vote: I like it +6 Vote: I do not like it

        First for the root logic. We're looking for a pair, (x, y) that fits the condition (x/y) = q[i] and (x%y) = r[i] and max(x, y) <= k.

        Since our max (x, y) needs to be <= k, what is the smallest x and y that can meet these conditions?

        well y must be greater than the remainder, and x will always be equal to y * q[i], so we want y to be as small as possible. So lets set y = r[i] + 1.

        Now the greedy portion:

        low remainders as well as low quotients are obviously more "valuable" because it makes it easier to satisfy the condition max(x, y) <= k.

        Each quotient or remainder can only contribute a maximum of 1 to the overall score, so it makes the most sense to pair the each quotient with the (LEAST valuable aka largest) remainder that still satisfies the condition so you can save the more valuable remainders for the higher quotients.

        lets say we have k = 11 and we have q = [1, 5] and r = [1, 5].

        f = smallest such y that meets conditions y/x, y/x = q and y % x = r

        f(q[0], r[0]) = 3 f(q[1], r[1]) = 35

        f(q[0], r[1]) = 11 f(q[1], r[0]) = 11

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

      ohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh

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

      thank you so much

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

Did I over complicate or was D such a pain to implement .

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

    My implementation is horrible for D (quite sure there exists some better implementation). But the primary idea was the greedy pairing of I(V / X).

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

351059087 what i am doing wrong in this..I think problem is in 2nd while loop

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

I feel like the description of the problem B is somehow incomplete. There can be some tests where the solution doesn't exist.What about the test case as n = 5, b[n] = 0 0 1 1 1? Here we can't perform the exact n operations!

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

    they said there was a guarunteed solution

    "there exists at least one way to choose l and r for each action and reorder the elements at the end so that a becomes equal to b"

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

      What about the test case as n = 5, b[n] = 0 0 1 1 1. Here we can't perform the exact n operations!

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

        this case cannot occur as a test case as it is guaranteed that a solution exists according to question

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

    The input testcases will contain only those where it's possible to do exactly n operations.

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

possibly the worst problem D of any div2 round

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

how exactly was D accepted in a modern cf round? my hatred for it is especially strong since it resulted in me getting an rte on my last-minute submission for F due to a lack of time

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

    Actually, I quite like this kind of problem, especially for someone like me who can't solve problem F. It allows me to focus on enumerating the prefix and suffix scenarios of the question mark sequence without overthinking.

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

    I would say D is quite good problem, no DS, no some obscure algorithm, no gpt.
    Also it encourages good programming practice, the cleaner you write the easier to debug your logic.

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

      I was just lucky it worked on 2nd try for me. I would never debug that mess...

      But i get your point.

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

How am I able to submit a hack if I can't view the code, when every submissions that I clicked in (even my own) display as "N/A"? Does anyone have the same issue like me? Please help me with this issue, I have had this issue for the last two weeks.

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

    GuessForces.

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

    I know the pain !! I guess perhaps the admin can help with this problem??

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

      Yes I hope so, because sometimes I also want to learn from other peoples' submissions as well (and also sometimes hack solutions). I've encountered this issue for over a week but there's still no support. I wanted to tag admins but I don't know if doing that may disrupts them.

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

        I was able to view solutions probably 3 weeks ago, but now i can't anymore, which is weird. Did you manage to see source codes last time?

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

          About 3 weeks ago, yes. After that every contest that I tried to open submissions in standings and in status, all of them including my own was blocked. That is strange, maybe a bug in Codeforces? Anyway, I only hope that this issue will be fixed soon. There are already many technical issues on the page that need to be handled first.

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

            Glad that I wasn't the only one! I thought my ranking is low and that's why I couldn't view other's code. I only take this as a hobby though. It may affect others who take this seriously.

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

Can someone please explain to me how to solve problem B?

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

    Thinking about how to include more elements in a single operation. This value is equal to the smaller of the number of non-zero elements in the array and the sum of the array minus (n-1) (ensuring that there are numbers left to add in the remaining n-1 operations).

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

    We can easily do it using binary search. We first count all the non zero elements of array B. Let's term this value nz. This way we know our answer x will always be 1 <= x <= nz. Now we simply binary search on the value of x.

    For any "mid" which is a candidate answer of x:

    sum(b[1...n]) — mid >= n — 1 should always be satisfied. Why? This is because if x is a genuine candidate answer, then there should at least be 1 operation of length x hence we see if the remaining difference is greater than n — 1. Because is no way we can increase the sum less than n — 1 in exactly n — 1 operations. 351013821

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

      if u dont mind can u paste here

      • »
        »
        »
        »
        5 months ago, hide # ^ |
         
        Vote: I like it 0 Vote: I do not like it
        #include <bits/stdc++.h>
        #include <iostream>
        #include <set>
        #include <map>
        using namespace std;
        typedef long long ll;
        typedef long double ld;
        typedef vector<long long> vll;
        typedef pair<ll , ll> pll;
        typedef vector<int> vi;
        typedef vector<string> vs;
        typedef vector<pair<long long, long long>> vpll;
        #define all(v) v.begin(), v.end()
        #define sz(x) ((int)(x).size())
        #define getunique(v) {sort(all(v)); v.erase(unique(all(v)), v.end());}
        void show(vll &a) {for(auto it : a) cout<<it<<" "; cout<<endl;}
        void show(vector<vll> &a){for(int i = 0; i < a.size(); i++) show(a[i]); cout << endl;}
        
        // Header files, namespaces,
        // macros as defined above
        #include <ext/pb_ds/assoc_container.hpp>
        #include <ext/pb_ds/tree_policy.hpp>
        using namespace __gnu_pbds;
        
        #define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
        
        void solve(int tc){
            ll n;
            cin >> n;
            vll arr(n);
            for(int i = 0; i < n ; i++) cin >> arr[i];
        
            sort(all(arr));
            ll sm = 0, nz = 0;
            for(int i = 0; i < n ; i++){
                sm += arr[i];
                if(arr[i] > 0) nz++;
            }
            ll s = 1, e = nz, ans = 0;
            while(s <= e){
                ll mid = s + (e - s)/2;
                bool isPossible = sm - mid >= n - 1;
                if(isPossible){
                    s = mid + 1;
                    ans = mid;
                } else{
                    e = mid - 1;
                }
            }
            cout << ans << endl;
        }
        
        int main(){
            ios_base::sync_with_stdio(false);
            cin.tie(NULL);
            int t = 1;
            cin >> t;
            for(int i = 1; i <= t ; i++){
                solve(t);
            }
            return 0;
        }
        
    • »
      »
      »
      5 months ago, hide # ^ |
       
      Vote: I like it 0 Vote: I do not like it

      what is wrong in this:

      #include <bits/stdc++.h>
      using namespace std;
      #define endl '\n'
      #define all(x) (x).begin(), (x).end()
      #define sz(x) (int)(x).size()
      #define pb push_back
      #define S second
      #define F first
      #define RAND(l, r) ([&](){ static std::mt19937 rng(std::chrono::steady_clock::now().time_since_epoch().count()); return std::uniform_int_distribution<int>(l, r)(rng); })()
      using ll = long long; 
      const long long INF = 0x3f3f3f3f3f3f3f3f;
      const ll MOD =  998244353; 
      ll modpow(ll a, ll b) {
          ll res = 1;
          while (b > 0) {
              if (b & 1) res = res * a % MOD;
              a = a * a % MOD;
              b >>= 1;
          }
          return res;
      }
      void solve() {
          int N; cin >> N; 
          vector<int>A(N);
          int Sum = 0;
          int zeros =0;
          for (int i = 0; i < N; i++) {
              cin >> A[i];
              Sum += A[i];
              zeros += A[i] == 0;
          }
          int ans = 1;
          for (int i = 1; i <= N - zeros; i++) {
              if (Sum - i >= N - 1) ans = max(ans, i);
          }
          cout << ans << endl;
      }
      int main() {
          ios::sync_with_stdio(false); 
          cin.tie(nullptr);
          cout.tie(nullptr);
          // freopen("workspace/input.txt", "r", stdin);
          bool tc=1;
          int t;
          if (tc)cin>>t;
          else t=1;
          while (t--){
          solve();
          }
          return 0;
      }
      
  • »
    »
    5 months ago, hide # ^ |
    Rev. 3  
    Vote: I like it 0 Vote: I do not like it

    if sum of all elements == n then ans is 1; else we have to check, How many positions we can fill in one operation with non-zero elements. (as we can form a from b by shifting also)

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

    The "dumb" solution would be: * sort the b ascending * start filling the a greedily — go through the b and choose l/r for every element, like this: l=i, r=n, for every i-th element record b[i] pairs * note the 1st such recorded pair is the longest one * the above is the greedy filling, which may end up in less then n rounds, lets say we have extra unused rounds (extra = n — number of pairs) and we need to distribute them somehow * now going in the pairs array in reverse, reduce the length of the pair to 1, deducting the reduced length from extra * once extra == 0, the 1st pair is the longest one

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

C was a nice problem. But D kinda ruined the experience 😭😭

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

    yes

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

    please share idea of C !!!

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

      let y=r[j]+1

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

      You sort the quotients in descending order and the remainders in ascending order. For each remainder b[i], you can set y from the question as y = b[i] + 1. This is the minimum possible y. Now, using this, you can find the value of x by choosing the most suitable quotient value by iterating in the quotient array (descending sorted) from L -> R. This can be achieved via something like two-pointers. For every remainder < k (since minimum y = remainder + 1) , we can always move right in the quotient array finding smaller quotients which satisfy the current remainder. Once we exhaust all the quotients or the remainders (or both), we can simply print the answer. My sol : 351039957

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

        thank you for your explanation !! I did something similar but wasn't sure why this is gonna be maximum we can do

        • also this felt a bit complicated to me.. so I was expecting there is some trick or observation which makes things easy
    • »
      »
      »
      5 months ago, hide # ^ |
       
      Vote: I like it 0 Vote: I do not like it

      for c for every number we can say that q array is quotient array and r array is remainder array so the number so formed will be x=q*y + r from which i can find out the limit for q in terms of r by manupulating the equation we can get :- q<= (k-r) / (r+1) let us say it is limit this tells us maximum q value an r can accept so now we will make this limit array and we will sort both q and lim array and do greedy matching like for every q we will find smallest possible limit with help of two pointer and then we will count the number of matching which will be our final answer

      you can refer to my submission :- [submission:https://mirror.codeforces.com/contest/2170/submission/351027443]

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

      Hints:

      1. Can we get x and y as f(q,r,k)?

      2. For some q, is there a bound on r?

      3. Think greedy!

      Finally, see It was so simple like greedy scheduling but my brain was caught up somewhere else. Bad day :(

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

WHY ISNT PROBLEM D THE LAST ONE TS WASTED LIKE 99% OF MY TIME ON THIS CONTEST >:(((

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

The plague of heavy implementation has infected Educational Codeforces Rounds. Let's see who will be the next victim.

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

Way too many solves for C. Too many cheaters in the contest.

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

    if you look it is very simple once you get a simple math observation (that observation too is a maths fact only)

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

      please tell the observation

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

        for numbers q[i] and r[j], the relationship between x and y is

        x = q[i] * y + r[j]

        from here you can find that the minimum number that works for y is r[j] + 1

        you can then check if a pair of numbers works by checking if

        q[i] * (r[j] + 1) + r[j] <= k

        finish the problem by greedily matching together pairs of numbers.

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

        for a given mod if it is high enough then it should be paired with as small q as possible and the y should be (remainder+1) from that we can conclude that for a given mod in descending order we should consider q in ascending order if for a given mod it can be paired up with q then we should use that q and move right and if we cant use that then it can be proved that any bigger q cant be satisfied even as x will be remainder +((remainder +1)*q) so it will be better to leave that q for a smaller mod. pleases go through my code once to understand better

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

          yeah I think not being able to use bigger q is the idea which makes this work, thanks !!!

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

            the whole next day will be gone well because of the joy that i could explain my approach to a candidate master :)

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

              oh nice !!! ... keep it up, you are on your way to better ranks above me,

              I seem to be going downwards lol !!

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

btw, I very love D, for less guessing than other div2D and some transition between states (... but currently I'm not yet submitted)

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

My name starts with D, today D is sad because D is bad

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

couldn't solve D, but struggled with C also ... is there some simple solution for C

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

    C is pretty standard binary search on answer. For x = q*y + r, we know that y > r. Also, if some no. of removals is possible then less no. of removals than that is always possible, so the partition point can be binary searched.

    If we sort both q and r arrays, then it's obvious that taking a small prefix of both is good because smaller values of q and r will ensure that x and y remain <= k. Additionally, for each choice of r, we can take y = r + 1, as that will result in smallest possible values of x and y. If we were to test for an answer take, then we take take length prefixes of q and r arrays (after sorting) and pair them in reverse so that i-th largest r matches up with i-th smallest q. This minimizes the x value.

    You can check my impl: 351181458

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

What a ride till problem C !

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

D is hardest :(((((

I think the solution of D is if — then until die....

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

how to solve E?

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

    First, you can observe that a string is beautiful if it consists of more than one block. Because if it contains an even number of blocks (>= 2) you can remove either the first or last block, and if it contains an odd number of blocks(>= 3), you can remove one of the middle blocks, then 2 blocks of the same color would merge and you would decrease the number of blocks by 2, it doesn't work if you only have one block because the string will become empty which is not beautiful.

    After that the problem just becomes find the number of binary strings such that none of the given ranges is contained inside one block (i.e. have only 1 type of bit), You can solve it using dp, specifically you can think of the state as the position you are currently in, and the transition is adding a block, while making sure you that no given range is contained inside one block.

    so dp[len] = number of binary strings of length n satisfying above condition, you can reach it from dp[len-1], dp[len-2] ... dp[0]. but you need to exclude cases where the block you will be adding will violate the conditions. so you maintain the maximum L for all ranges such that R <= len, and you can only now transition from dp[len-1], dp[len-2], ... dp[maxL]. Because if you transition from any states before that you will violate one of the conditions (the block added will contain one of the ranges).

    To do these transitions quickly you can use prefix sums. Refer to this submission for more details.

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

weak pretests on edu round :(

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

is there something wrong with the b tests/input constraints? there are so many solutions getting hacked for wa

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

Very nice ABCEF, But one bad problem can ruin the contest. D is so disgusting.

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

The author after putting problem $$$D$$$ in the contest

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

bad gap between C and D

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

Problem D was a pretty cooked problem tho :|, with less solves than E

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

Is the test in the contest an official test?

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

C was amazing

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

What is the idea for D? I tried splitting it up into ?X/V, I?, ??, and ? and going from there, but this doesn't work.

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

Why there wasn't overflow test in task B? I got hacked :-(

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

Why were the tests so weak got my solution hacked due to integer overflow bad contest.

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

D is INCREDIBLE good problem, I LOVE IT SO MUCH

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

    What is the solution idea for it?

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

      put as many IV or IX as u can

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

        Thanks for the reply, Nyemot. I tried to do that, but I couldn't figure out how to precompute all the necessary details for the code to run in time. Can you please help me understand how to do this?

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

          I submitted this verbose version of my solution after contest 351091920
          It might be hard to read here, maybe copy it to your IDE.
          Tell me what you think, also if you still don't understand some things, feel free to ask again.

          Code
        • »
          »
          »
          »
          »
          5 months ago, hide # ^ |
          Rev. 2  
          Vote: I like it +1 Vote: I do not like it

          Let Z be some large value (X or V). We know that intuitively, we want to use as many I's as possible, and use V's and then X's iff necessary.

          In solving the problem, one of the first observations I made was that we can break the input string down into blocks of ?s; this problem can probably be solved with a different, simpler approach, but let's go with this for now. Following this, we can store the size of each block, along with a boolean/integer flag for whether the determined character to the immediate left of the block is I (called aL) and whether the determined character to the immediate right of the block is Z (called aR). This is the only information about the surroundings of each block we need.

          For example, with the string "X????V", our block would be of size 4 with aL = 0 and aR = 1.

          Now, we want to compute the amount of pairs of IZ that we can possibly make in some block, and we will find this given the amount of Is we will put into it (called k); let's call this function f(block,k). We know that, ignoring aL and aR, our formula is trivially f(block,k)=min(k, block.size-k) because the # of IZ pairs is limited by both I and Z. Now, if we only have aL=true and aR=false, we can set the first ? in our block to Z, so we have min(k+1, size-k) IZ pairs, and vice versa for if we only have aR. Therefore, our comprehensive f is f(block,k) = min(k + block.aL, (block.size-k) + block.aR).

          So, to recap, we now know the amount of IZ pairs we can get in each block. All we have to do now is maximize the amount of IZ pairs we can make globally while using all of our available Is. So now, let K be the amount of Is we are allowed to use (per query). Effectively, we want to distribute this K into multiple smaller ks that we can give to each block. In order to do this, we can observe that f is always concave, with a slope of 1, 0, or -1. So, let's define d(k) as f(k)-f(k-1) (essentially slope), observing that it is non decreasing for increasing k. We can now state that f(k) = f(0) + sum(d(t) for t=1...k)), and that f_all(j) = sum(f(0) for all blocks) + sum(sum(d(t) for t=1...j_i)) for all blocks), where f_all is the global amount of IV pairs given some array j with j_i for all blocks (j sums to K; here, j can be thought of as a 'config' for f_all).

          Given this, and seeing the first part of f_all, our initial intuitive step can be to simply store the sum of all f(0) for all blocks in a single variable to use for each query; let's call that F0. Next, we also know that, intuitively (for the lack of a better explanation), d(k) is the "potential" for f at some point k, in that it shows whether f still has more "room" for IZ pairs (d(k)=1) or not (d(k)<1), and we also know it holds a numerically equivalent relationship with how many IZ pairs we actually make. So, we can essentially combine all multisets d into one large multiset D, which stores these deltas/slopes for all blocks. Sorting this descending, we find how many IZ pairs we will make using an optimal strategy is D(x) for x=1...K given some K from the query. To make this O(1) per query, we can just store a prefix sum pref for D, and so our total amount of IZ pairs given K is always F0 + pref[k].

          So, overall, we now have the total amount of IZ pairs we will make in our blocks. We can trivially compute the contributions from the predetermined characters before processing queries, and then add the contribution from our ? blocks following our greedy strategy to maximize the # of Is we use, then Vs, and then Xs to obtain our final result.

          Submission: 351062521

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

    I agree.

    It was kinda mess and i was lucky for sure to not spend hours debuging it.

    But i dont mind implementation-hell problems. If its like 1 in a month or so. I was much happier from it passing then usual.

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

Was D just heavy casework?

e.g. ?V, ?X, ?, ??, etc?

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

    The solution for D was not too hard to think of but it was just a bit of caseworkey problem. My approach was kinda nice.

    Spoiler
»
5 months ago, hide # |
 
Vote: I like it -15 Vote: I do not like it

I appreciate the announcement. I'm looking forward to the round; the extended ICPC format should make it interesting, and the problemsetter lineup appears solid , Gl everyone !

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

It's always just integer overflow... why...

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

D is cancer

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

Hello, I received the similarity warning for my solution in this round. I did not share my code with anyone and did not copy from anyone. It is possible that I once used an online IDE that unintentionally made my code public. I understand this is against the rules even if unintentional, and I sincerely apologize. I will make sure this never happens again. Thank you for checking.

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

Problem D

Greedy approach: 1) replace all "?" with "I" and compute the score. 2) replace question mark "I" with "V" for those scores that change by +2, +4, +6 respectively (three loops) and save all the results. 3) finally answer the queries with the precomputed scores, adjusting by cx * 5 since we worked with "V"s

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

Recently, your account was used to crawl. Please change your password to prevent your account from being used for unauthorized activities.

I don't know if this issue is common or not. But this is the first time I've come across this message on Codeforces, and it's already pissed me off. Manually viewing 4-6 submissions per minute is not even close to crawling, come on. This behavior makes a full-fledged hacking phase impossible. I hope that the administrators will eventually be able to adjust the upper activity limits to an adequate level.

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

    I'm getting the same issue. How do you make it go away? Are we just not allowed to look at like 6-7 solutions per minute or something?

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

      I didn't do anything specific to make it disappear. The first time I got this message, it lasted for more than an hour. I tried changing my password but it didn't lift that warning, it eventually vanished itself. The second time, about half an hour without any actions from me. But the third time, it had lasted for at least 3.5 hours which made me write the original comment. Also, after each attempt of opening any solution (including my own solutions!), it logged me off with a message You are temporarily blocked by the administrators. As if the administrators tracked me down and manually blocked me for me daring to open 6 submissions per minute.

      The worst thing about that message is that it doesn't explain its criteria and reasoning (Codeforces, what kind of authority are you to restrict human users from browsing solutions?), and it doesn't tell you how long you have to wait and how you can appeal this decision. This is very annoying, to say the least.

      Alright, forget about hacking phases. Imagine an even simpler yet more important case. Will a coach be blocked for opening a dozen of their students' solutions at a time? Sometimes it is more convenient to browse them en mass. I would be glad to receive any kind of comment from MikeMirzayanov on that case and on the whole situation in general.

      P.S. I never understood why people had alternative accounts on Codeforces. Although I'm not planning to use alts any time soon or later, I won't be surprised if someone turns out to be using alts just because of such a situation.

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

I'm very happy to take 2nd place after virtualing this round!

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

Hi all

A newbie here. I registered for this one as a rated contest and managed to solve 2 :P but it's showing as unrated contest in my profile with no rating update. Could someone please let me know why could that be?

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

LLMs are ruining Codeforces. It's hard to believe that in an educational round, over 200 users managed to solve six problems. Just a few hours ago, the proportion of pupils and newbies among the top contestants was even larger than that of grandmasters. Although the situation has improved somewhat after the administrators issued bans, a significant number of low-rated users on the leaderboard are still pulling off the "feat" of solving all problems in just 30 minutes. If this continues, Codeforces' rating system will likely collapse.

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

I hope the cheaters get banned

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

Very weak pretests :(

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

Last time problem A has a weak preset and this time problem B has a weak preset... I don't dare to participate in educational rounds because of the massive hack on a problem

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

why does it get so much downvote

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

why did this blog get so many downvotes? can someone explain the reason?

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

Hello, I received a plagiarism warning for problem 2170C. I did not copy from anyone, and I did not share my code with anyone. Any similarity is purely coincidental because I solved the problem myself during the contest. Please review my case. Thank you.

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

the test in problem B very weak T_T

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

okay so got this comment saying one of my solutions matched with xyz and all, not sure how that happaned, but i will make sure it wont happen again

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

my ratings are not yet updated even after the hacking phase

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

wtf with the pretest of B? Is it because there’s a hack phase that they don’t care about constructing the pretest at all?

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

    I think the main reason for that is this: You generally want small numbers for interesating test cases in this problem. You want to aim for sum < n.

    And there is even a second problem: The most naive "overfloat check" where n=200000 and every b_i=n does not even fail (at leas on some hacked solutions). Because it actually overfloats back to positive and you just need the sum >= n, not the exact value of n.

    Also, being hacked is a learning experience. Yes, weak tests are bad. But now you know how to solve it better next time.

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

why do some dislike the rounds they don’t perform well in?

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

Pure math roll out of XCPC!

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

nice pretest for problem B

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

Terrible testcase for B. Getting hacked just because I didn’t use long long feels bad. If it hadn’t been accepted, I would have figured it out during the contest.

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

Six seveeeen

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

weak test may lead to many successful hack.

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

Why round is unrated? I hope that it is a bug.

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

My answers have been skipped i don't know how it has been same to some other person I don't even know him/her. It's entirely unnecessary, please check its entirely coincidence, answer of question A has been matched which is very unlikely. I am sure you will do due diligence and my answers won't be skipped.

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

Why does the problem explanation for Question D describe a problem that is quite different from the original one, and the code also seems unable to pass

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

Hello. I received a plagiarism warning for submission 351056694. I would like to clarify that I solved the problem independently and I do not know the other users whose solutions were mentioned. I did not share my code anywhere, and I did not use any public compilers or platforms.

It is possible that the similarity occurred coincidentally, especially since many participants may arrive at similar dynamic programming implementations for this problem.

Please review the situation again. Thank you.

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

Did they just solve a less awful version of D in the editorial ? That version of D looks much better than this one.

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

.

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

weak pretests again :D

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

I mention one thing, last contests are starting like this anymore, idk why A- Easy B- Medium C- Easy D- Expert E- Hard F- Medium suprising us all as usual

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

Actually my fault, but B is accepted during the round without long long :(

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

B weak pretest let me remain be newbie :(

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

do u get ur rating?

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

several months into codeforces but waiting for rating update feels the same everytime

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

it seems this contest all unrated, but why?

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

I haven’t received my rating.

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

SIX SEVEN!

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

Thanks for this round, it was good

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

What the heck is wrong with the tag for problem A?

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

Here is my screencast:

https://youtu.be/YtJoNIC6lG4

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

Hello

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

AOA

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

Hello