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

Привет, Codeforces!

В Jul/30/2021 17:35 (Moscow time) состоится Educational Codeforces Round 112 (Rated for Div. 2).

Продолжается серия образовательных раундов в рамках инициативы Harbour.Space University! Подробности о сотрудничестве Harbour.Space University и Codeforces можно прочитать в посте.

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

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

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

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

Также от наших друзей и партнёров из Harbour.Space есть сообщение для вас:

Codeforces and Harbour.Space

Привет, Codeforces!

Прошла неделя с тех пор, как завершился Harbour.Space Scholarship Contest. Это был интересный опыт! Мы рады поделиться результатами раунда и выразить признательность каждому участнику.

Еще раз хотим поблагодарить авторов и координатора раунда, благодаря которым этот контест состоялся в кратчайшие сроки:

Спасибо за вашу усердную работу.

Поздравляем всех победителей:

1-3 место: Ali.Kh, Yousef_Salama, early-morning-dreams

4-10 место: sunyx, amanbol, IMRED, Meijer, loan, kpw29, Huah2

11-15 место: dhruvsomani, adamant, Kaitokid, RetiredPlayer, c8kbf

Мы рады сообщить, что рассмотрели заявки всех победителей и скоро примем окончательное решение о дополнительных стипендиях. Следите за обновлениями и своим почтовым ящиком!

Помните, чтобы претендовать на стипендию, вы должны ответить на письмо отправленное 3-4 дня назад. И чтобы убедиться, что адреса электронной почты не были написаны с ошибками, мы хотим воспользоваться этой возможностью и попросить Yousef_Salama, Huah2, adamant, c8kbf, Naseem17 связаться с нами по электронной почте ([email protected]) или написав сообщение Harbour.Space.

Поздравляем победителей:

Место Участник Задач решено Штраф
1 SSRS_ 6 92
2 tourist 6 120
3 WZYYN 6 127
4 Sugar_fan 6 131
5 Tlatoani 6 140

Было сделано 57 успешных и 612 неудачных взломов.

И, наконец, поздравляем людей, отправивших первое полное решение по задаче:

Задача Участник Штраф
A Geothermal 0:01
B tourist 0:03
C kaiboy 0:04
D dario2994 0:07
E tourist 0:11
F rainboy 0:30

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

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

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

i hope i can get top 10 in this contest

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

I hope that this contest will be as good as CF Round #735. And maybe even better

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

Hope this educational round actually have balanced problems unlike the last edu round

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

Please don't start hopeforces again

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

28/07 -> July Cook-Off 2021

29/07 -> Codeforces Round #735

30/07 -> Educational Codeforces Round 112

31/07 -> July Lunchtime 2021

31/07 -> AtCoder Beginner Contest 212

01/08 -> Leetcode Weekly Contest 252

01/08 -> Codeforces Round 736

Raining Contests

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

I hope I can break my unconditional love with FSTs in this round.

:(

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

Please get me out of this losing streak. I'm doubling in rating loss each time.

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

y would anyone waste their time going to some trash unaccredited university, beyond me tbh

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

Good luck, guys!

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

I hope, I won't become turquoise again ^^

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

Good luck to everyone!

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

My first Contest as Expert , will try my best today to move up more !!

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

Hopefully this contest won't make you worry about your setters' safety.

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

I hope I can solve B XD

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

It's time to move up.
Good luck for everyone

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

Hope that there won't be any Bitwise-operators tonight.

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

I hope I will solve B in this contest

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

MikeMirzayanov I think something is wrong with my registration. It shows me as a official participant. Can you please fix it? I don't want to lose master.

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

Maybe there's sth wrong with Problem D.

How can a string which length is 1 can be changed to an "beautiful" string ?

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

    Because it is given that we have to consider only "palindrome of length greater than or equal to two".

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

just realized why A is the hardest problem ..

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

The announcement which came for C, should have come early. I was solving a different C, where Alice is looking for the maximum and then Bob goes with the minimum afterward.

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

    No, you should have read the statement more carefully.

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

      Yeah, you are correct. But the announcement itself proves that the statement was unclear.

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

        No,it proves there were more people like you who didn't read the statement properly and were bugging authors with queries.

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

Solved D at 01:50, so happy! ^__^

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

After giving yesterday's contest. This one feels so much better. Regained some confidence again. :)

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

When you solve A,C, and D but not B. Sigh...

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

B had more cases than law courts!

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

In my opinion, C was much easier than A and B. Thanks.

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

I think A,B is way more harder than C,D and E lol

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

I took 47 minutes to solve problem B (+ penalty), but 9 minutes to solve problem C and 15 minutes to solve problem D....

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

I'm so disappointed of myself Idk why my B solution is wrong :( :( I solved C easily I could have read D but I kept saying I will solve this B

Submission

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

    I might have missed it in your code but did you check x1 and y1 to the walls or the walls to x2 and y2?

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

      nah I just realized my mistake I thought we place the second rectangle from (0,0) what a stupid understanding I did

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

Mathforces. 4 wrong submissions for A :(

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

score distribution is same for all problems? i have solve only C and D today but ranking is same who slove only A and B.

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

    Its educational round, that's why !

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

      How educational rounds are different from normal round?lazywitt

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

        They are by definition different, as in there is no semantic meaning in this difference. It's not that "oh this is educational so let's teach them how to treat all problems equally" or anything. It's just by definition. Educational and Div3 rounds follow ICPC style contest rules, where Div1, Div2 and most others follow point based score distribution rule where difficult problems are assigned higher points.

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

Nice contest, E is a very interesting problem.

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

    how did you solve e? I tried doing a nested binary search on the minimum values to take and maximum values but it TLE'd.

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

      I did that too initially, but binary search is actually not needed. Just use two-pointer, extend right bound until the whole interval is covered and then update the answer.

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

      How are using binary search here? After fixing the minimum value, we can do a binary search on max values that's fine. But how can you do a binary search on minimum value ... Then you will have to iterate linearly for minimum value?

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

        Depending on whether or not there are any valid max values(using a certain min value) I will choose to either lower or increase my min value. It sounds pretty dumb and it didn't pass either but if you are really curious you can read my code.

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

    Is downvoting comments complimenting contests becoming a trend?

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

Why was A and B (didn't read rest) so "heavily" math based compared to other general As and Bs? I'm surprised so many people got A, toughest A and B I've ever seen, also first time seeing both the starting two problems are math.. which is surprising considering most of the people can only do A and B (I'd expect something which has to more with programming than complete maths). IMO

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

    Well, you can't have every A be "you have an array and you need to permutate through it and do and do x". Sometimes there has to be math involved, and let's be honest, it wasn't a lot.

    And "toughest A and B I've seen" seems comical when yesterday there was a B rated 1700.

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

    If this is your "toughest A and B", then 1. You haven't done many contests in CF. 2. You don't really know what is a tough problem and what is not.

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

Unfair constraints for python in problem D

same code for c++ https://codeforces.com/contest/1555/submission/124343239 got accepted but

python code got tle https://codeforces.com/contest/1555/submission/124338639

Headquarters MikeMirzayanov, Round Coordinator BledDest, one of the authors Errichto

please look into this.

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

    1) We are not creators of Python. Go complain to them. I think that CF staff only cares about easy problems being solvable in slow languages.
    2) I have nothing to do with this problem. I was mentioned in the blog as an author of the previous round -_-

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

    even though I am a newbie here in code forces or should I say in this whole cp genre .but i know that [1] you must not tag Authors and other GM unnecessarily in (unless you'r LGM YOURSELF). [2] you must wait for editorials to come out before asking too much question [3] be respectful. Nobody here's the homeroom teacher

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

      It's a valid concern. Python may have timed just around the given time limit. So asked organizers to see if time could have been higher for python based submissions. Codechef does it and so do many problems in codeforces have elevated time for problems like the one (https://codeforces.com/contest/1553/problem/B)

      PS: It's not unnecessary tagging. Also even with editorial there are times that solution writer didn't go with simple solution. Tagging is just one thing. If you don't think you are right person to answer, just leave it.

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

        I agree with the first part of your reply regarding elevated time for problems. however, there's a place to ask such questions you don't ask them in comments here and tag people.a better way is to go into to contests "**Ask a question** section..this isn't insta or fb.

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

    Wow. So many downvotes for no reason. I raised a valid concern for god's sake.

    The problem https://codeforces.com/contest/1553/problem/B. works in 500*3 (about 10**8) complexity , but my solution in today's contest has time complexity of (12*10^5 + 2*10^5) in worst case and i still got TLE.

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

      It's not a new issue. Many times python and java solutions get TLE due to strict time limit(Ask secondThread lol). Nothing can be done after contest.

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

      """Each participant has the right to choose the language that he likes. Together with all its pros and cons. Yes, Java runs a little slower on average, but it has better static analysis in the IDE. It is quite typical for IT tasks that the tool is chosen for the task. And yes, I'm sure it's not a bad thing that sometimes you encounter purely programming difficulties. Understanding that not all ways to read or write data are the same is helpful. In particular, it is important to understand the basics of buffering. Specifically, in your case, knowing the standard library of the language in which you write is also useful. You are using Arrays.sort, but not reading the documentation. Read it finally.""""
      - MikeMirzayanov, March 2021

      Spoiler
      Spoiler
      TL DR
      At last
  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится +5 Проголосовать: не нравится

    Use pypy with some fast io (fast io is an issue even in c++ so it's kind of fair).

    Your code ACs in 732ms: https://codeforces.com/contest/1555/submission/124358306

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

      ok.I could have simply taken pypy3 instead of python to save my points. But may be in next contest

  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится +5 Проголосовать: не нравится
    1. You have a choice of languages, Python is known to be slow, and Codeforces make it very clear that the time limits are the same for all languages. I normally choose to use Python, for ease of writing, in spite of this, but I know that its performance, even using PyPy, can be a problem.
    2. When you select the standard Python interpreter (cPython) as your submission language Codeforces tell that PyPy is normally faster
    3. I am not sure why your code is slow, but my Python code for this problem runs well within the time constraints using either Python or PyPy3. See my contest submission using PyPy3 and the same code run with Python 3
»
3 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

a lot of case works in B :/

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

What the heck is wrong with guy who set up problem B. Like you really want the people to stop logical coding using their thinking skills and just spend 15 minutes considering all the cases like a donkey, and spend another 30 debugging when they get a penalty on the same code. Is this the way the best coding platform wants to evaluate its participants? If yes, then good luck/bye caseforces!

PS : i think the problem setters just wanted to minimize the nuumber of people who could attempt the good questions afterwards by just sticking them to this **** problem!

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

    Nevertheless, I did not like problem B either. It was just implementation, no thinking.

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

      Basically, you can just try moving it along only x-axis or only y-axis. There is no need to move it in both axes.

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

Problem F:

I used HLD to solve it. Can somebody please tell does there exists any approach without HLD?

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

    Did you use HLD to find usable edges? I'm not sure but I think the problem boils down to single usage of an edge in the tree formed from all the queries and if that's the case, we can split the tree about an edge that can't be used anymore, and re-root the smaller component with another parent? Just like small to large merging. PS : We can keep splitting a tree into forests by this process.

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

      Initially, I made a tree by using only edges which are first time connecting any two different components, then observed that any cycle can span atmost one edge of the tree. After that, used HLD for max path queries. So after that anytime got validation for adding any edge just set all values of all edges to infinite (basically deleted). To check validation, just did a max path query.

      Can you please tell in your approach after splitting into forest how are you checking for any query.

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

        Yes I was thinking of the exact same thing. But just to confirm, please tell me if this is right. First off anytime a tree edge arrives we can add it. Otherwise I found a sum for each node in the tree that denotes the xor of the path from the root to that node. If 2 nodes are in the same tree in the current forest of trees and have xor of Node sums = (edge ^ 1), then they can be connected. Otherwise they cannot be connected. Now if they can be connected, we can disconnect each edge on the path between them using the process i described before and recalculating the sums and root Node for each Node in the smaller component.

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

        dnshgyl21 I think your implementation does not consider the fact that it will be a HLD forest, you always start from root 0.

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

    Model solution is without HLD. We'll describe it in editorial, but shortly, we first find the MST of the graph (using the time when the edges are added as weights, to find the edges that are definitely present in the answer), then create a logarithmic data structure like Fenwick or Segment Tree to mark the edges belonging to a cycle and/or verifying that the cycle we're adding doesn't intersect with some previously created ones.

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

      Can you please describe how can we mark edges on any path in a tree using Segment or Fenwick tree?

      Upd : Thanks,i got it now.

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

        There is a way to range addition on the path from $$$v$$$ to $$$root$$$ and range sum on path from $$$v$$$ to $$$root$$$ using two Segment Trees, but it's not needed here.

        Since each edge will be marked at most once, you can mark edges one by one while asking a sum on path: all using Fenwick tree on Euler tour.

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

could someone tell me whether i am wrong with these i have tried my own these problem link

void solve(vector<int>v[],int src,vector<int>&euler,unordered_map<int,int>&mp,int &counter) {
    euler.pb(src);
    if(mp.find(src) == mp.end()) mp[src] = counter;
    for(auto i:v[src]) {
        counter++;

        solve(v,i,euler,mp,counter);
        counter++;
        euler.push_back(src);
    }
}

void storeminimum(vector<int>&euler,int sq,vector<int>&sqrtd) {
    for(int i=0;i<euler.size();i++) {
        sqrtd[i/sq] = min(sqrtd[i/sq],euler[i]);
    }
}

void Main() {
    int t;
    cin>>t;
    for(int kk=1;kk<=t;kk++) {
        int n;
        cin>>n;
        vector<int>v[n+1];
        for(int i=1;i<=n;i++) {
            int m;
            cin>>m;

            for(int j=0;j<m;j++) {
                int a;
                cin>>a;
                v[i].pb(a);
            }
        }
        // first occurance 
        unordered_map<int,int>foc;


        // store euler path 
        vector<int>euler;
        int count = 0;

        solve(v,1,euler,foc,count);
        int sq = ceil(sqrt(euler.size()));
        vector<int>sqrtd(sq,INT_MAX);
        storeminimum(euler,sq,sqrtd);
        int q;
        cin>>q;
        cout<<"Case "<<kk<<":"<<endl;
        while(q--) {
            int a,b;
            cin>>a>>b;
            int ans = INT_MAX;
            int l=foc[a],r=foc[b];
            while(l<=r) {
                if(l%sq ==0 and l+sq-1<=r) {
                    ans=min(ans,sqrtd[l/sq]);
                    l+=sq;
                } else {
                    ans = min(ans,euler[l]);
                    l++;
                }
            }
            cout<<ans<<endl;
        }
    }
    
}

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

Are you kidding me? I used old version of problem F statement where cycle was simple if there weren't any repeated edges. And this is the only reason why I didn't get accepted during the contest. I've got accepted in 2 minutes after the round ended, so sad(

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

    We are sorry, we actually noticed the bug in Russian version only, like, 10-15 minutes before the end of the contest :(

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

Can somebody please explain the solution of problem A?

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

    What I did was, write down N as N = 6a + 8b + 10c. Now this can be written as N = 2 * ( 3a + 4b + 5c ). Now let's take ( a + b + c = S ) , so we equation becomes N = 2 * ( 3 * S + b + c ), and b + c = S — a. So this becomes N = 2 * ( 4 * S — a ). Now just find a and S( and one thing if N is odd take N as N + 1, don't know the reason for this but it just worked for odd numbers because they are not divisble by 2 ).

    Now the total time required is TIME = 15a + 20b + 25c. TIME = 5*( 4 * S — a ). This is the answer.

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

      3*S+b+2*c

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

      The question asks to find x, y, z, when 6x+8y+10z is greater than or equal to n, find the minimum value of 15x+20y+25z

      Note that 15/6=20/8=25/10=2.5

      Let us make an equivalent transformation for the condition 6x+8y+10z >= n.

      3x+4y+5z >= (n+1)/2.

      Note that gcd(3,5) = 1 , so all numbers greater than 7=3*5-3-5 can be formed by adding several 3 and 5.

      For the part less than 7, it can be solved directly by violence.

      Code : https://codeforces.com/contest/1555/submission/124347937

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

    if(n<=6) we need only 1 small pizza giving ans as 15 mins Consider x small , y medium and z large pizzas : so number of slices will be n = 6x + 8y + 10z corresponding to it , time spent = 15x + 20y + 25z = 5*n/2 ( in terms of 1st equation) for odd number of slices , u can find that ans modifies to 5*(n+1)/2

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

    I listed out the first 20 values of n:

    1  2  3  4  5  6  7  8  9  10 11 12 13 14 15 16 17 18 19 20 21
    15,15,15,15,15,15,20,20,25,25,30,30,35,35,40,40,45,45,50,50,55
    

    and noticed that increases by 5 every 2

    out.println(Math.max(15, ((n + 1) / 2) * 5));
    
  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится +1 Проголосовать: не нравится

    If $$$n<=6$$$, print $$$15$$$

    For $$$n>6$$$, if $$$n$$$ is even, print $$$n*2.5$$$

    else print $$$(n+1)*2.5$$$

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

Expected to become an expert today, will probably end up as a pupil...
Spent both the hours on Problem A and got 7 WAs, lol.

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

    Almost did the same, then decided, 'hey, why not check other problems'.

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

      Can't argue with that, though I spent around an hour trying to figure out why exactly was even a brute-force solution giving me WA (Brute Force on n % 120, 120 being the LCM)...
      And I still don't know what exactly is wrong with my code...
      Edit:
      I finally realized that considering n / 120 and n % 120 separately doesn't always give the optimal answer.
      Eg: 121: My output would be 315, while the optimal answer is clearly 305.
      My program would waste 5 slices of pizza, while the optimal answer would only waste one.

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

        I had a similar approach like this but my code also gave WA, did you try for all i in the range 1 to 16. My code was giving wrong answer in this range and correcting for this got me Accepted

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

    If you saw the sample cases, you would've noticed the answer always being ((n+1) * 5) / 2 for n >= 6. Something to do with the fact that 15/6 = 20/8 = 25/10 = 5/2.

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

      Yeah, I guess the McNugget theorem can be applied to this problem as well.
      The McNugget Theorem
      6 = 2 * 3, and 8 = 2 * 4.
      3 and 4 are relatively prime, so the greatest number which cannot be formed by them is 3*4 — 3 — 4 = 5 (10, because of *2; 10 exists as the third term here, so it too is covered).
      Because we only need to consider even numbers (odd numbers can be converted to even), and we are working with *2 here, all the even terms above 6 will be covered.
      Numbers below and equal to 6 can be processed as a special case.

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

Solved 4 but still feeling worthless because of A and B xD

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

I spent 40 minutes on A and didn't have enough time to solve E :(

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

    I lost B to precision today.. just changing double to integer made it pass. Significant digits turned out to be so significant today :( The pain though!

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

B ruined my entire contest. Couldn't even read E though it was pretty doable. :((

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

124312667 this is my submission for problem B during the contest where i took the values float instead of long long and it gave WA. It gave a difference of 2 in one of the TC. 124345470 this is that same approach(everything same just changed float to long long) but got accepted....can any one pls explain why this happened. edit: by mistake initially i gave the link to wrong problem.

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

    precision error

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

      and why will float be less precise than int/long long

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

        Sometimes with floats, it will do things like $$$1.0000001 = 1$$$. This is why, when comparing floating point numbers, I like to do something like this:

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

          yes you are absolutely correct but my point is that if i am just having floats of type f.000000 and there is no multiplication just subtraction and addition then why would it give some difference.

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

          or just multiply 10000000 and compare normally

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

        google "precision error"

        it's not something someone can easily explain to you here

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

Can we do C using dfs ? I think it is the same as Cherry pickup II of leetcode ? please help.

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

But its a question afterall with a valid difficulty range for qstn. B. Also,its my fault that i assumed it to be something else. It actually didn't have much case work. Apologies..

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

Was thinking I'll regain Expert! But problem B exists lol, ate up huge amount of time :(

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

    Problem D is wonderful.

    Considering that a three-letter palindrome can only be

    abcabcabc... acbacbacb... bacbacbac... bcabcabca... cabcabcab... cbacbacba...

    Each position is symmetrical in rotation. So a simple prefix sum can be done for it. Code : https://codeforces.com/contest/1555/submission/124347304

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

      Of course it is! I came up with exact logic to compare with 3! strings and make prefix array (precompute) and answer queries in O(1) time. But sadly , time ran out and I couldn't implement it fully.

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

A clean(ish) solution for B.

Spoiler

We need to check for the number of free cells possible in both X and Y directions. (Free cells are the cells not occupied by the first table). If the number of free cells in ANY direction (X or Y) is greater than the number of cells needed for second table, then we can fit the second table in. The first table only needs to move horizontally or vertically to acommodate the second table, it will never have to move diagonally.

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

Is the rating predictor broken?

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

In reference to problem B 3 actions can be taken: 1. Rename the website to caseforces 2. Ban the guy who set it up from setting up future contests 3. The guy should have some self respect and delete his account

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

    What do you mean? There were only 3 cases: -1, horizontal fit, and vertical fit.

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

Should we be sad or happy in this case? :(

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

One of the best contests I have participated at in my life. Beautiful, Balanced and the Best

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

Actually problem B should be C and C should be B!

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

I admit I struggled at A took 30+ mins. I know it was quite easy but still.

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

hard contest only the first problem was easy

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

4 Div2 (with 2 Div1) Round, 2 Div3 Round, 2 Educational Round, 2 Div(1+2) Round, and 1 Global Round, Total of 11 Rounds held in this Month. So we can say July is the perfect month for all the contestants who like and enjoy every round of Codeforces. Thanks to Mike Mirzayanov and all the problem setters of this month <3

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

wonder how many guys copy-pasted their segment_tree for E from the Internet

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

    From which part of the Internet? Do you mean that general purpose segment tree libraries are available? Or a complete solution for exactly this problem is available?

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

    Can you please explain the approach of problem E? Where do we need segment tree?

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

A solution video for the first four questions of div 2

https://www.youtube.com/watch?v=NMSQ-uu59mQ

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

why to even use double in problem B as shown in sample output.

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

    it's a trick to fool people, and also it accepts solutions that somehow use doubles

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

    That was just to confuse us so that we start thinking the box both horizontally and vertically as shown in the example diagram.

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

    I wasted 5 minutes thinking that when can the answer be in double.

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

I misread problem D and thought that input string can contain any 26 letters of Latin alphabet and it is allowed to change any character of the string to one of the first 3 letters and couldn't solve that problem. Can this problem be solved?

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

    I think that it is possible if you spend $$$O(r - l)$$$ on each query or do precalc and spend $$$O(n^2)$$$

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

»
3 года назад, # |
Rev. 5   Проголосовать: нравится +5 Проголосовать: не нравится
The solution to Problem A with Proof:
  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится +11 Проголосовать: не нравится

    For the claim, you can give a one line proof by induction. It's true for $$$6 \leq N \leq 10$$$ and assuming it is true for all even numbers less than $$$N$$$ with $$$N - 6 \geq 6$$$ we can write $$$N$$$ as $$$N - 6 + 6$$$ and we're done by induction.

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

Nice round with not easy nor really hard tasks E is especially good!

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

Is anybody know which testcase is in task b test 2 case 554? My solve fails on it and idk why... Here is link on it https://codeforces.com/contest/1555/submission/124358523 [](https://codeforces.com/contest/1555/submission/124358523) plz say what is wrong...

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

Where's the editorial?

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

Questions about Karry5307_AK_NOI2024 again:

  1. How could he solve B in 29 seconds at 00:09:43 after he solved C at 00:09:19?
  2. How could he solve F in only 3 minutes after he solved E at 00:51? You see, SSRS_ solved it in 21 minutes, tourist solved it in 42 minutes, and WZYYN solved it in 25 minutes. These three are all LGM but they solved F in at least 20 minutes. How could this guy solved it for only 3 minutes?

I think there must be something strange.

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

    I think it is possible that he submitted B and C at the same time because of the bad Internet connection. But a more likely guess is that some people shared this account and solved these problems together.

    I am sure that this account's owner is not real Karry5307 because in China nearly nobody will register an ID of "I all killed a contest".

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

    Although he(they) might cheat,he(they) can't beat me because I am much stronger than h0up1ngze!

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

    If you check his submissions you can notice that after he submitted D, he coded F for 31 minute, but then got WA, after one more submission for F, he coded E in something like 2-3 minutes (the only code he actually wrote is in main, so I believe 3 minutes were enough), and after that he returned to F. In total he spent ~34 minutes for the last problem, which is quite legit.

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

    he/she is LGM now.

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

Can we do C using dfs ? I think it is the same as Cherry pickup II of leetcode ? please help.

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

Can anyone help me with problem B solution?? What I am doing wrong here? It is failing 2nd test. Here is the verdict: wrong answer 530th numbers differ - expected: '0.0000000', found: '1.0000000', error = '1.0000000'

here is code:

#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{

    int tc;
    cin >> tc;
    while (tc--)
    {
        ll W, H, x1, y1, x2, y2, w, h;
        cin >> W >> H;
        cin >> x1 >> y1 >> x2 >> y2;
        cin >> w >> h;
        ll ans = 0;

        if ((h + (y2 - y1)) > H && (w + (x2 - x1)) > W)
            cout << -1 << "\n";
        else if ((w + (x2 - x1)) > W)
        {
            //work vertically
            //cout<<"h="<<h<<" (H-y2)="<<H-y2<<" (H-y1)="<<H-y1<<" ";
            if ((H - y2) < h && y1 < h)
            {
                ans = h - y1;
                ans = min(ans, y2 - (H - h));
            }
            cout << ans << "\n";
        }
        else
        {
            //work horizonatally
            if (x1 < w && (W - w) < x2)
            {
                ans = w - x1;
                ans = min(ans, x2 - (W - w));
            }
            cout << ans << "\n";
        }
    }
}
  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    please help me what I am doing wrong here

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

      i think the problem is that you are not considering the case where u can fit it both vertically and horizontally.

      so i would suggest to look in both direction. Like here after going in elseif. it is not going to go in else to check if u can get a smaller ans

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

Have the solutions been rejudged yet? When will the ratings change?

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

Interesting Round, thanks!

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

Can we just appreciate that there is no pretest for D where m < n, so I got RTE. Nice.

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

what's the binary search solution for E? I am more interested in how to write the predicate function in o(logn) or so ?

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

MikeMirzayanov My submissions of this round skipped getting an unexpected warning that my submission to the problem C 124303153 coincides with the submission 124301236 by NZB. This is totally unexpected. The solution to problem C is super simple. I request you to manually check the submissions and the solution to problem C. I'm totally disappointed with this kind of wrong warnings from such a reputed platform like codeforces. Because this is the second time I have been convicted without doing any kind of violations. I wrote a detailed blog on this after getting my first warning but nothing changed. Please read the blog Unexpected warnings from CodeForces. Hope you will look into the matter. Thanks.

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

    MikeMirzayanov same thing happened with me for Question C. The problem was a very simple one.Please look into this

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

    The idea and code of problem C are really quite simple. So, the chances of having similarities in codes are high. Even, my submission's main function has a lot of similarities with you: 124324875. It's quite unfortunate and saddening to see such false-positive cases. I hope, MikeMirzayanov will look into this matter and sort out this thing.

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

    MikeMirzayanov This same thing happened to me too... I received an unexpected message from System saying that my submission was similar to some 10+ other submissions for this problem? This was purely coincidental at least on my end, since the problem's solution was so short.

    Here is mine: 124296686.

    Also my submission ID was earlier than every other submission mine was considered similar to, so there's no way I could've copied/cheated from any of these people.

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

Someone, please explain the first test case of question 5

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

Did anyone who solved F use lca,dsu & merge small into large?

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

When I tried solving problem B using long double for output, I was getting WA on Test 3. But when I used long long instead of long double in the same solution, it got accepted. Why? Can someone please explain?

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

    I think it's because of your output format. You used cout for printing double value. But you didn't set any precision or width. A good way to print double/floating value using cout is: cout<<fixed<<setprecision(10)<<res<<endl;. Your failed solution was printing in this format: 6.55587e+006. Which might have led to the precision error.

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

One constructive feedback : It would be really nice if educational rounds had atleast one problem with a high upsolve value for Div2 contestants, i.e. problem that is slightly out of reach for majority of Blue/Purple contestants.

In this contest, E is a very standard lazy segtree problem and F is (seems ?) too hard.

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

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

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

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