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

Автор awoo, история, 4 дня назад, По-русски

Neapolis University Pafos

Привет, Codeforces!

Благодаря поддержке Neapolis University Pafos, продолжается серия образовательных раундов. Университет предлагает получение степени бакалавра в области компьютерных наук и искусственного интеллекта со стипендиями JetBrains. Получите передовые навыки в области искусственного интеллекта и машинного обучения, которые подготовят вас к востребованным техническим карьерам. Любопытно? Ознакомьтесь с учебной программой прямо сейчас. Доступно ограниченное количество стипендий. Не упустите свой шанс учиться в Европе бесплатно!

В 18.02.2025 17:35 (Московское время) состоится Educational Codeforces Round 174 (Rated for Div. 2).

Этот раунд будет рейтинговым для участников с рейтингом менее 2100. Соревнование будет проводиться по немного расширенным правилам ICPC. Штраф за каждую неверную посылку до посылки, являющейся полным решением, равен 10 минутам. После окончания раунда будет период времени длительностью в 12 часов, в течение которого вы можете попробовать взломать абсолютно любое решение (в том числе свое). Причем исходный код будет предоставлен не только для чтения, но и для копирования.

Вам будет предложено 6 или 7 задач на 2 часа. Мы надеемся, что вам они покажутся интересными.

Задачи вместе со мной придумывали и готовили Адилбек adedalic Далабаев, Иван BledDest Андросов и Максим Neon Мещеряков. Также большое спасибо Михаилу MikeMirzayanov Мирзаянову за системы Polygon и Codeforces.

Удачи в раунде! Успешных решений!

UPD: Разбор опубликован

  • Проголосовать: нравится
  • +34
  • Проголосовать: не нравится

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

As a tester, I will give my 100% with best wishes

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

I wish be expert in this contest

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

I wish be expert in this contest

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

As a participant, I can't spell BledDest without $$$\textbf{st}$$$.

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

Good luck everyone! I hope I can climb back to Specialist

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

I wish problems are in my favour

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

score distribution?

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

Hoping for +1.

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

after a long time i guess.

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

Ill reach expert tomorrow

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

Ill reach expert tomorrow

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

I'm not a magician, but u'll get WA at test 2 in problem B tomorrow

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

Hope this will be one of the best contests I've ever participated in!

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

Hope this will be one of the best contests I've ever participated in!

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

excited!

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

I hope to improve my rating now, I had a bad streak.

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

As i participant i would participate

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

hi toppers of coding.

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

Hoping for positive delta :D

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

First Edu round in 2025?

Hope to reach 1700!

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

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

а в чем разница Educational от простого соревнование?

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

and what is the difference between Educational and a simple competition?

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

    tap

    it says: "Educational rounds are meant for learning and not exactly practising (normal CF rounds).

    There is a 12 hr hacking phase once the contest gets over in case of Educational rounds. Hence, for rating update u must wait for 12-13 hrs :(

    Standings in Educational rounds are based on number of problems solved and penalties, whereas, in normal CF rounds, its based on total points earned (points for each question decrease with every passing minute)"

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

HOPE the A,B problems are doable and not too difficult like recent rounds. (for newbies like us to even have a chance to solve some problem)

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

all the best for everyone,hoping everyone would increase there ratings

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

I wish be master in this round.

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

Last contest I become Expert,but this time I will return to the pinnacle!

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

Last time I become Expert,but this time I will return to the pinnacle!

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

Believe I your self and no one can beat u

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

Pls no GCD again.

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

Hope you become grandmaster if you pray for Palestine!

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

SpeedForces scheduled.

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

Thanks for the non GPTable D. Atleast not by just copy pasting the question. I tried it out by participating unrated.

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

    Yeah, D did feel like it would give chat gpt a hard time visualising it

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

ShitForces

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

Problem E is close to this problem: 1686D - Linguistics

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

I hated E. D was not the best as well. I guess C was the best one ...

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

How to solve C?

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

    simple dp count number of subsequence 1 2 2 .. 2 3

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

    Considering every element must be between 1 and 3, we can see that beautiful sequences are in form of 1, 2, ... 2, and 3. So we can do dp on this. Consider following dp[N][3]: dp[i][j] -> number of valid subsequences ending on i with value j.

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

    You can check that the array must be in the form 1...3 where "..." represent one or more 2s.

    Number of subsequences would for that form would be 2^n — 1, as any number of 2s (except 0) work. But checking all 1s and 3s (say using a prefix count array) would be O(N^2).

    O(N) solution would be to count number of 1s so far, i.e. cnt1++. when you encounter 2, double curr and add cnt1. This works similar to the 2^n analysis count above. When encounter 3, you close the subsequence by adding curr to ans.

    Remember to mod for each operation

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

      can u plz explain how your doing all this is equivalent to doing operations on all pair a formal proof will be really appreciated

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

Tests for E are terrible tbh

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

Why This this code fails for problem B?

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

    I made the same mistake when the component size > 1 it is a bipartite graph so you always need 2 colors (instead of the component size).

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

      could you elaborate a bit more? Didn't really get what you mean by bipartite here

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

        Yeah when the component size > 1, we only need to do 2 operations. There is no odd cycle in the grid, so every component is a connected bipartite graph (See the definition of bipartite: https://en.wikipedia.org/wiki/Bipartite_graph ).

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

          Oh yeah you're right. Still I think my logic should always separate into two sets (I.E TLE instead of WA) Any clue on why it isn't working? 306733695 WA on 1451st ;-;

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

            My code does the same. Did you find the reason for WA on 1451st testcase? 306712208

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

              Nope couldn't figure it out. I think in that case our code is overcounting as if I change my code to min(2, count), it passes but TLEs later.

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

        Actually you dont need any bipartite graph i just check if any same value element has its neighbours or not .If it has some neightbours then taking that value take two chance else one chance take the n-1 lowest chance elements

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

    I really like how clean your code is, gonna adapt some of these style for my next contest!!

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

How did you all do C? I wasn't able to solve it after trying a lot of times, always failing test case 3,4,5 or TLE

I tried checking all the indexes of 1 and 3 in the given array, and for n number of 2's in between the indices, I added $$$2^n-1$$$ to the answer, making sure to use MOD exponentiation. :(

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

    Iterating over the pairs of 1 and 3 is O(n^2), which is too slow. So, you have to compute the answer for the leftmost 1, paired with all 3's after it. Then, iterating from left to right in the array, we adjust the answer little by little (if we encounter a 2, ans /= 2; if we encounter a 3, ans--).

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

      Thanks! :)

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

      could you elaborate a bit? I didn't understand

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

        An easier way to do it is with dp. dp[i][j] = number of subsequences in arr[:i] that end with j (and that are valid, ie you can't have sequences with multiple 1s or 3s). dp[i] = dp[i-1], and if arr[i] = 1 add 1 to dp[i][1], if arr[i] = 2 then you can append 2 to any previous subsequence ending with 1 or 2 so it's dp[i-1][2]*2 + dp[i-1][1], and if arr[i] = 3 then you add dp[i-1][2] to it. Return dp[-1][3].

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

How to solve E?

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

    Here's my attempt for solving E:

    • You first check all the strings with alternating letters:

    • For odd length ones (e.g.ABABA or BAB), add their (length — 1)/2 to "sum" which stores all the potential parts that you can replace with either AB or BA. This makes sense intuitively because you can always put any combination of ABs and BAs in an odd length alternating string — just take out one letter from it.

    • For even length ones (e.g. BABA), add their (length — 2)/2 to "sum", because you can take any combinations of AB and BA from them but need to exclude two letters (e.g., if you want to take "AB" from "BABA", then you have to treat the "B" at the front and "A" at the end independently). If you want to process the entire one using either AB or BA, store the length/2 to an array — there is an array for "AB" and another one for "BA".

    • Sort the arrays, process them from small to large. For instance, for the "AB" array, first check if the number of ABs left can cover up the currently smallest one needed. If yes, add one to the sum and deduct the covered amount from AB; if not, break.

    • Check for the independent As and Bs by iterating through the entire string. If the number of A/Bs available plus min(AB+BA, sum — ones that can be covered up by AB/BAs) is less than the actual frequency, the answer is "NO", else "YES". I think my explanation might be unclear or abstract. It is definitely helpful to look at some code!

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

1685B - Linguistics

p.s. i didn't know the problem and didn't solve E this time

positive delta plzzzzzzzzzzzzzzzzzzzz

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

Can anyone please tell why my code is failing for B? 306758770

I cant find where this will go wrong :(

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

Can someone please tell me why my code is failing on B? Cant figure it out :(

306758770

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

I did not realize C was just dp lol... I did it in such a different convoluted way 306723210

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

Tutorial: How to solve E

Firstly, solve this problem

https://codeforces.net/contest/1686/problem/D

Then solve E

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

Took 66 minutes and 3 WA for A and B each but solved C in 26 minutes first try lmao. I probably should've reread the problem and not spam solutions.

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

Who is discussing today's contest ??

Shayan ? Aryanc403 ?

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

no wonder, how we have so many ac. https://www.youtube.com/watch?v=f2tbS12SLFw this guy leaked the solution :)

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

problem C already existed: 105444G - Gig Combinatorics jasjajs

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

problem C already existed hashhas: 105444G - Gig Combinatorics

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

306742121

C. WTF is wrong with this DP solution why am I getting TLE

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

Why is my code for B giving MLE? I have following code:

Spoiler

Every one of my variable should be around 5e5 * 4 = 2MB? And I have four of such variables(queue, singleDouble, visited, a). So shouldn't this be 10MB? Very less than 256MB limit?

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

If you don't want DP for C here is mod inverse(I hope don't get hacked).

Also did anyone felt problem A to be hardest like if the ordering was C D B A then it would be better?

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

    could you explain your code

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

      Chain of thought:

      1. Answer has to be 1 2(1 or more occurance) and finally 3
      2. If we fix 1 and 2 and there are $$$k$$$ 2 between them in total we can take either once making 1 2 3 or twice 1 2 2 3 or k times at max
      3. So for every 1 and 3 having k in between we have total of $$$2^k -1$$$ possible answers
      4. On every 3, all the preceeding 1 will contribute some subsequences. We need to calculate for each one.
      5. For say 3 1s behind the current 3, and total number of 2s till 1st 1 is a then b then c and at this 3 it is d then total answer till this 3 as ending is $$$2^{d-a} -1 + 2^{d-b} -1 + 2^{d-c} -1$$$. So on for more
      6. $$$2^{a-b}$$$ is just $$$2^a/2^b$$$ then we have $$$2^d * [Inverse(2^a)+Inverse(2^b)+Inverse(2^c)] - 3$$$ so we can have this formula you can see in $$$solve()$$$ function when I see a 3 I just do this formula and I maintain this inverse sum in $$$curr$$$ and keeps $$$total1$$$ and $$$total2$$$ seen so far. $$$total2$$$ is used for calculating inverse sum at each 1 and $$$total1$$$ is subtracted at each 3 on calculation and is the last term in formula above
      7. It is linear with $$$log$$$ term for inverse and calculating $$$2^a$$$

      Edit: Integer overflow hacked. Use 2LL instead of 2 here

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

        I was trying the same thing but could not figure out how to count multiple 1s for a fixed 3 faster. Your simplification on step 6 makes so much sense. Thankfully, I was able to figure out the dp soon after and got AC on this. I'll try reimplementing using this approach.

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

Why this is giving WA I am just counting for all the colour group with max no. of people who are not stranger and taking the max from all the groups and doing sum of those except the largest no. group which i will make all the other colour to that colour

Here is my submission Link

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

    bro i did the same mistake actually there is greedy in this question maximumm set of strangers for the particular element cannot be more than 2 actually think about it consider the case 2 2 2 1 3 4 5 3 2 1 1 2 3 4 4 according to the logic we can make 2 set of stranger colors for 2 like consider [0][0] and [0][2] as the same set like there can only be maximum 2 sets of strangers for particular color i think

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

      what's the size of row and column for the test case you gave?

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

        3*5

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

          I am getting correct answer for that test case.

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

            i think your's one was failing for 33rd of 2nd test case as well in the contest? it was same for me by the logic of getting the maximum connected component but that way the answer is not minimum

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

              Yes it is failing in 33rd only but why?

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

                n=2 m=3 5 5 5 4 4 4 consider this text case 33rd one according to our logic we would have got the maximum connected component i mean consider the sets we would have gotten 3 for 4 and 3 for 5 right? and we would have subtracted 6(which is the sum)-maxi(3) ok so we are getting 3 as a result now try to making two sets of each i mean consider one set of 5 which is stranger as {5,5} which is [0][0] and [0][2](since they don't share the sides) and the second set{5} as [0][1] same for {4} we have two sets alright? now in maximum 2 moves either for 4 or 5 we would have changed the colors of 5 to 4 or vice versa so the answer is 2 for this case not 3

      • »
        »
        »
        »
        3 дня назад, # ^ |
          Проголосовать: нравится 0 Проголосовать: не нравится
        /**
         * author: vanshgambhir
        **/
        #include<bits/stdc++.h>
        #define ll long long
        #define vi(n) vector<int> v(n);
        #define loop(i, n) for (int i = 0; i < n; ++i)
        #define all(v) v.begin(),v.end()
        using namespace std;
        int dx[]={0,-1,0,1};
        int dy[]={-1,0,1,0};
        bool check(int row,int col,int n,int m){
        	if(row>=0 && col>=0 && row<n && col<m) return true;
        	return false;
        }
        void solve(){
        		int n,m;
        		cin>>n>>m;
        		vector<vector<int>> v(n,vector<int> (m));
        		for(int i=0;i<n;i++){
        			for(int j=0;j<m;j++) cin>>v[i][j];
        		}
        		vector<int> freq(n*m+1,0);
        		for(int i=0;i<n;i++){
        			for(int j=0;j<m;j++) freq[v[i][j]]=1;
        		}
        		for(int i=0;i<n;i++){
        			for(int j=0;j<m;j++){
        				for(int ind=0;ind<4;ind++){
        					int newr=i+dx[ind];
        					int newc=j+dy[ind];
        					if(check(newr,newc,n,m)){
        						if(v[i][j]==v[newr][newc]) freq[v[i][j]]=2;
        					}
        				}
        			}
        		}
        		ll sum=0;
        		for(int i=1;i<=n*m;i++){
        			sum+=freq[i];
        		}
        		int maxi=*max_element(freq.begin(),freq.end());
        		cout<<sum-maxi<<endl;
        	}
        int main() {
        	ios_base::sync_with_stdio(0); 
            cin.tie(0); 
            cout.tie(0);
        #ifndef ONLINE_JUDGE
        	freopen("input.txt","r",stdin);
        	freopen("output.txt","w",stdout);
        #endif
        	int t;
        	cin>>t;
        	while(t--){
        		solve();
        	 }
            return 0;
        }
        

        check this code for reference it is accepted

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

For B, what is the result supposed to be for:

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

:(

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

Problem A took me 30 minutes to debug because the array is not initialized. I finally solved only 2 problems. Goodbye Specialist.

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

    Humans are under-performed sometimes. I fumbled on C for no real reason. Better luck next time for all of us

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

How D?

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

Thanks, I was 1395 but now I will not be a specialist yet :)

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

Hurts :")

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

Problem B was a nice challenge! I got a 10x dopamine boost after getting AC. The statement was a bit confusing, but overall, it was a great problem. What should the rating for B be? I think around 1200.

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

CAN ANYONE TELL WHY THIS IS FAILING TEST 3

306757323

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

    ll possible = (1 << twos); cnt of $$$2s$$$ between $$$1$$$ and $$$3$$$ can be very large, it won't fit in int or evern 64 bit int,
    also you'r code is $$$O(n^2)$$$ it will tle for large test.

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

moi je suis très satisfait des concours de codeforces , il sont très bonnes + éducatifs + entrainement . bonne chance à tous les participants et les inscrits dans codeforces .

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

What is a successful hack test for B?

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

Thanks a lot for D! It's the best binary search problem I have solved till now!

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

Hoping to become Specialist. Wish me luck. Why the hacking phase is so long. All the best of good ratings to everyone.

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

Emmm. E may be a little ad-hoc. I thought it could be a non-greedy problem. But when I found the correct greedy strategy, I had spent $$$70$$$ minutes on E. When I found F is a simple use of Segment Tree Divide and Conquer, I feel very upset!

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

I found D easier than the usual Ds of Div2. Don't know about others. Submissions are also less, but I felt it like mid B-C level.

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

Could someone explain why my B won't pass? if a color has no strangers, it can be changed to a third color in 1 operation, else it would take 2 operations. So I just count the number of operations required to change all colors to a third color. It would be optimal to change all colors to an existing one. If a 2 operation color exist, it would be optimal to change all colors to that one, else we can change all colors to any arbitrary color. If there is only one color, we don't need any operations. What am I missing?

https://codeforces.net/contest/2069/submission/306732090

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

    You used v.size() in both dimensions. The logic itself is sound.

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

      this is the second contest in which I was not able to solve B due to some stupid mistake :< Thanks for pointing it out!

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

        same lol i have literally the same approach and thought procedure as you, yet mine fails too :( https://codeforces.net/contest/2069/submission/306824298

        i'm not able to figure out at all what edge case i'm missing

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

          Initialize the map at the beginning instead of else m[a[p][q]]=0;

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

            alright! system testing is going on right now so i can't submit the code right now but how does initializing earlier help?

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

              For the test case:
              1
              2 3
              1 1 2
              2 2 1
              Your code might incorrectly assume that color 1 only needs one operation, but it actually requires two.
              The reason is that there are no other '1' around the '1' in the bottom-right corner,so your code will remark it as requiring only one operation.

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

Can E be solved by using flow ?

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

Why I'm unrated bros

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

when will system testing start and by what time will the ratings be updated??

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

I submitted my solution for Problem B using Python, but it resulted in a TLE on test 7, even though the same logic implemented in C++ got accepted. The expected time complexity of my approach is O(n * m * log(n * m)), so I’m unsure why the Python version is slower. Additionally, my solution was hacked post-contest, which makes me even more curious about the efficiency issue.

Could someone review my Python code and help identify the reason behind the TLE? Here are my submissions for reference: Python C++

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

    I believe that in Python, dictionaries can get blown up by specific testcases which can make dictionary operations perform in O(n) time instead of O(1) time. With C++, it is the same issue with unordered map, but you used ordered map, so it's fine. You should have used an array to hold the stuff from the dictionary since the keys can only go up to n*m (700 x 700). It is common for dictionary and unordered map users to get hacked post contest unless that is checked for in pretests.

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

I had my TOC(Theory of Computation) paper yesterday. Problem A from the round literally reminded me of it. If you don't know which subject is TOC just know that you have to find a string of symbols which is accepted by the machine(automata) in it.

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

Please make better pretests. Seriously... negative mod is not a very rare or unexpected problem when its a problem about PIE (the brute force is literally summation of all j > i where a_i = 1 and a_j = 3, 2^(count of 2s between i and j) — 1), so some people would keep the PIE by subtracting by prefix frequency of 1s.

This is a standard issue, and while is a dumb error on the participants' part, is a minor mistake and should be penalised with a WA on tc 4 or something, not a FST/hack. How do you fail to catch this? And this isn't a small issue either, By going from the 3000 place to 3500, I was able to find 8 fsts within an hour without even inspecting every single one... i skipped by 5 or 10 randomly sometimes. Such a common mistake should be penalised.

Please do better. Or maybe???? insane idea... add testers to Edu rounds? Like seriously EVERY other division has testers, and they end up with nicer problems (this is not only my opinion there are many in the community who beleive this), I'm sure some people would be willing to test so why not introduce that... Your three person team appears to be incompetent at problemsetting.

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

Please check why my approach to C gives a MLE

here

I haven't learnt dp, I tried without it

ans should be the summation(2^k_i — 1) where k_i represents no. of 2's between every pair 1,3

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

Why is carrot not working to predict ratings for this round?

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

So when can the editorial be published?

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

When will the ratings be updated?

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

When will you give the editorial??

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

This a very good contest problems are easy but a bit tricky

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

i rigistered for rated, but it shows me unrated, why is that happening

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

Why is it unrated?

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

I believe this round was rated right? will they update the score or the round became unrated ?

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

When we will get our rating changes? Is system testing done?

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

Who can tell me why I was unrated in this contest?

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

The system test doesn't seem to have started yet. Just stay patient—things will happen when they're supposed to.

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

will they publish the result? and why its too late?

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

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

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

will we get results today??!!

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

Not me hitting the refresh button every 10 second for rating change.

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

Gta 6 will come before rating changes

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

Why did this BFS-based approach in B result in an MLE? The idea was simply to perform a BFS from each unvisited cell to find the size of the connected component of the same color as that of the cell and we would mark all cells in that component as visited. If the size was $$$\geq 2$$$, meaning that to color all these cells, we would need 2 operations. Thus, we update the cost for converting these colored cells into another color to be 2.

simply does in $$$O(m \times n)$$$ memory and space complexity seemed to be safe.

Submission : Submission

»
44 часа назад, # |
  Проголосовать: нравится +8 Проголосовать: не нравится
  • When we will get our rating points?
  • Yes.
»
44 часа назад, # |
  Проголосовать: нравится +52 Проголосовать: не нравится

Me waiting rating change

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

Why does it take so long for rating? What are they doing? Haven't they considered optimizing these evaluation times?

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

Feels like the next contest will happen before rating changes come for this one

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

Guys no worries Rating changes will be updated soon I have texted Mike