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

Привет, Codeforces!

В 08.01.2023 17:35 (Московское время) состоится Educational Codeforces Round 141 (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 есть сообщение для вас:

Harbour.Space

Привет, Codeforces!

Мы рады объявить о втором буткемпе по программированию «Hello Muscat 2023», продолжении серии буткемпов «Hello», организованном Harbour.Space University в сотрудничестве с PhazeRo, Gutech, UK Oman Digital Club, Leagues of Code, Gutech CS Club и Codeforces!

Довольно впечатляюще, не так ли? Пришло время глубже погрузиться в мир соревновательного программирования с 8-дневным интенсивом Hello Muscat 2023. Он будет проходить в Маскате, Оман, и онлайн с 8 по 16 марта 2023 года, доступны оба формата участия.

Наш тренерский состав сочетает в себе талант и опыт, в нем участвуют чемпионы мира ICPC, победители и финалисты, а также легендарные имена из области соревновательного программирования: Михаил Мирзаянов MikeMirzayanov, Егор Дубовик 244mhq, Артем Плоткин Rox, Максим Обозный MaksymOboznyi и Николай Будин budalnik.

Буткемп будет разделен на три дивизиона:

  • Дивизион A. станет зеркалом Петрозаводского лагеря программирования. Подходит для команд, которые уже прошли квалификацию на Финал ICPC или стремятся к этому.
  • Дивизион B. Разработан, чтобы помочь командам подготовиться к следующему сезону региональных соревнований ICPC. Подходит в качестве введения для команд и студентов, которые только начинают свой путь в мир ICPC и соревнований по программированию в целом.
  • Дивизион C. Предназначен для новичков в мире соревновательного программирования.

Типы участия: очное и онлайн

Мы считаем, что участие в нашем буткемпе должно быть доступно для всех команд, где бы они ни находились, и именно поэтому мы сделали очную и онлайн-формы участия. Скидка 20% на раннее бронирование предоставляется университетам и участникам, которые зарегистрируются и оплатят до 31 января 2023 года.

  • Очное:

Цена: 1500 € — 1200 €

Что включено: обучение, контесты, доступ к записям лекций, проживание в течение 9 ночей в 4-звездочном отеле Mysk, завтрак и обед, трансфер из гостиницы к месту проведения буткемпа каждый день, развлечения и приветственный подарок.

  • Онлайн

Цена: 100 € — 80 €

Что включено: обучение, контесты и доступ к записям лекций.

Узнать больше о Hello Muscat 2023→

Удачи в раунде,

Harbour.Space University Team

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

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

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

Best of luck everyone.As a participant I am going to give best in this contest.

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

Good luck everyone. Hope i can solve problem C

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

Hope to get good rank at contest which I am not able to do so in previous rounds

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

i still remember awoo's favourite problem

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

Good luck to everyone!!! (I hope that I can solve at least one problem :>)

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

Wow, I'm back after a year and comments are as cringe as ever. Joining in.

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

Good luck everyone . Hope I can solve at least one problem.

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

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

good luck have fun

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

me after solving a&b : Your text to link here...

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

me after solving a&b :

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

Classic Mathforces

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

oh yes I saved the previous non-blue profile pic somewhere else and I am getting to use it now

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

Any proof for B?

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

seriously, what is the point of problems like B, where you have to find some stupid pattern on a grid?

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

    I wasted time thinking that question is asking for only border elements.

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

    Why do you think that is a silly thing to do? It trains observational skills.

    Regardless, its not like patterns in grids of numbers are a meaningless or trivial thing to study. There are a ton of problems that can be represented as patterns in grids of numbers.. Doing regression in data analysis for example.

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

Too much penalty >:( and I thought the condition in problem B is $$$a_i + a_j$$$ instead of $$$|a_i - a_j|$$$.

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

so my approach for problem C was since the nth player can at max have n wins . so a win against him would increase my chances of having a lesser rank . i tried defeating maximum players from the end. and then sort the number of wins for each player in decreasing order and decide my rank why wouldn't this logic work ?

here's my submission https://mirror.codeforces.com/contest/1783/submission/188487469

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

People asked for binary search, dp, segment tree problems aand... here we ended up

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

    I think C was a beautiful problem , though B was little annoying to me

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

      I didn't mean that, C, D, E are very much algorithmic problems, but many of my friends complained about them being too hard ( I think they are easy)

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

      how to solve c?

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

    Most of the good contests I participated in had at least one of them

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

Problem B was annoying :(

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

How to solve B?

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

As always Educational rounds are worst.

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

is problem c Segtree or vector of priority queues since ai<=1000 or I completely overcomplicated ?

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

    It has to be on Binary Search but this mf B wasted an hour and my mind went blank coz of that so couldn't even think properly about C

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

    Key observation is because each player plays each other the other players will have 1, 2, 3, 4... wins... If you can beat the player with exactly 1 more win than you while still maintaining the optimal number of wins than your place is (n-wins+2), else it is n-wins+1

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

GOODBYE EXPERT!! These hit and trial B's are the worst

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

Rounds like these make me wish there was an un-register button on Codeforces just like on Atcoder. Wtf was problem B???

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

How to solve D? Spent most of my remaining time trying to solve it...

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

Can we solve C using Binary search?

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

Did we have to check only from prefixes and suffixes in the C problem? Like we try to win against only suffixes or only prefixes or some prefixes and suffixes combined? (for the sorted array)

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

Is D even DP ? 💀

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

A: If min==max no solution, else {min, max, (anything)} is a solution.

B:[1, n^2, 2, n^2-1, 3, n^2-2...] arranged along any path of the matrix

C:Sort the array and you will get an almost-best solution. But it needs an extra check to get the best solution. When you've checked first k opponents with least time to prepare, look for whether you've prepared for the opponent with index k+1. If not, check whether you can remove a prepartion and prepare for (k+1)th opponent.

D:Consider for every possible value of sum(ai*sign_i), where sign_i = 1 or -1. There are at most 180000 different values, and run dp for an O(n*A^2) solution.

E:Seemingly easy inequality problem, but naive implementation will get TLE. For certain k, if all multiples of k are not in any range [bi,ai-1], then k is good. We need a segment tree to check all values of [1,n] in O(n*log(n)).

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

    [E] You don't need a segment tree. Just do range sum using prefix arrays and iterate over all multiples of k for every k.

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

    Do I check whether I can prepare for the k+1th opponent in the sorted array or in the orignal array?

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

      Original

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

        Please correct me if I am wrong.

        The logic is: If I can beat any k opponents it means I will rank alongside the k+1th person in the rankings right? So I check if I can add a preparation for the next highest opponent which I have not prepared for and remove prep for the lowest index which I have prepared for so as to beat k+1th opponent right? Such that my number of preparations always remain the same so I beat the opponent removed on total number of wins anyway.

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

          If you don't prepare at all, the wins of each other player is their index (1-indexed).

          In fact, if the number of preparations is fixed at k, you win k matches, and for each other players with index i, their number of wins will be i-1 (you prepared for it) or i (otherwise). Notice that if i < k+1, then i<=k and i-1<=k, which means whether you prepare or not, the number of wins of i-th player cannot be larger than you. It's similar for i>k+1 (their number of wins will be always larger). So only i=k+1 will matter.

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

Through this edu round,I know a fact that I'm a totally trash.Maybe I can never be an expert.

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

Very surprised by number of B and and C solves, B confused me while C seemed like a trivial sorting problem

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

Worst B ever. Period.

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

    I didn't solve B, but I liked it. It tests one's observation ($$$n^2-1$$$ upper bound) and simplification (solve it for 1d array first) skills.

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

    That is because you didn't find a key idea of it,so your code was very long.If you found that $$$1 \sim n^2-1$$$ must be able to express,you could know that $$$n^2$$$ must be adjacent to $$$1$$$,easily we could expand it into an easy solution.

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

How to approach problems like B? I solved it by randomly guessing stuff.

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

    Have you ever solved tasks from mathematical olympiads?

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

      No. How would that be useful to tackle such problems?

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

        These problems aren't random guessing, it's just math.

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

          how exactly do you approach B mathematically?

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

            This is the type of question like "how mathematicans prove theorems" or even "how tourist solve CP tasks".

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

            The process "find the strictest lower/upper bound for the answer and then show that it's reachable" is common in math competitions (not only that, it also frequently appears in algorithm correctness proofs). This is the first step to the solution: it's quite easy to see that the answer is bounded by $$$n^2-1$$$ (all differences are positive, and the maximum difference cannot be greater than $$$n^2-1$$$).

            Then, to actually find the way to reach this bound, you need to try some common techniques to solve problems. You can take a look at MikeMirzayanov's post on these techniques. From these, we have already used "Bold Hypothesis". The "From Specific to General" (with a twist, since we actually change the problem partially instead of just simplifying it) may help us as well: 2D sounds too complex, what if the problem is in 1D instead? This case sounds way stricter: we have only $$$n-1$$$ adjacent pairs, and all of them should be distinct. Believe it or not, but having stricter constraints actually makes the solution easier, inventing a construction on one-dimensional array is not that hard.

            Spoiler

            All that's left is to convert the 1D solution to 2D, which means that we should go through the matrix visiting all its cells, which is a common math/programming problem.

            Spoiler

            Note that our process of solving the problem used something like "try to apply a concept and then see if it works" multiple times, and this is very common in both math problems and harder programming problems. So getting familiar with these concepts and methods will not only help you solve some constructive and/or ad-hoc problems, but also the more difficult ones, where you have to mix it with some standard data structures and algorithms.

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

              Want to add something: some hard tasks require to try a dozen of different approaches before solving the task. This is common not only for constructive and maths, but for interactive problems, graphs or even data structures.

              And solving those "just guess" tasks improve your thinking skills and allow you to recognize some patterns in future tasks.

              So, dear contestants! Instead of just "problem was too bad", answer the question: was it hard or just difficult? Many people claim that the task is "bad" if they weren't able to solve it in time and got negative delta.

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

                I had to tinker around with some randomly put together constructions till I came across the solution.
                Proving it seemed easy once it was clear.
                Definitely not appropriate for problem B, but it's an edu round and technically the order doesn't matter, so whatever, ig.

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

              My opinion on the quality of Problem B has changed after reading this comment

              Thanks

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

          what's math in that?

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

          But I think, here intended solution was random guessing!:(

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

    Thats how you solve it, xD

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

After failing to submit E in the last 10 seconds the last time(Jan 6), this time I found the solution of E in the last 5 minutes and got AC just 5 minutes after the contest ended... [Sad]

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

B spoily my mood and I gave up after 20 minutes

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

Hi there! I try to help people by upsolving contest problems and post them after the contest on my channel — https://www.youtube.com/@grindcoding . I have been trying hard to help people by solving daily challenges across platforms and also the contest problems. Please provide me suggestions on what I can improve. Have uploaded problem C of this round already and would upload others as required by anyone of you. Any advice is appreciated :).

P.S. not the channel who promote leaking solutions during live contests. I know it provides better growth with the huge amount of cheaters, but I understand it's detrimental and against the overall spirit :) happy coding :) Soon would be making a good data structures and algorithms course to help beginners (though not a pro myself but want to contribute as I grow).

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

Here is the intuition I used to solve problem B:

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

A tough contest to me :(((

problem B needs a lot of observation :((((

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

Any hints to approach problem 'C'?

Really reject stopping solving problems regularly T_T

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

got stuck with b and no time left to think about c .. uff time to go back to green

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

Participate in post contest discussion

www.peer2peer.social

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

Wow, I really enjoyed the problemset! Problem F is just otherworldly *_*

Huge thanks to the developers of the contest! <3

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

Nowadays the problems in the contest are not properly sorted in the order of their difficulty. Sometimes the problem B is made very hard, whereas sometimes it is made as easy as A, and in this case the C problem is made very very Hard.

It would be nice if the difficulty order would be made moderately increasing.

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

Welp this was a waste of time.

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

Problem B was horrible and problem D was harder then E.

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

was anyone able to get the solution to E with $$$n√n$$$ time complexity?

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

It was a worst contest I have ever written. My problems never been hacked by some random pupil ranked participant.

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

Tips for Python

In Python, you can put negative indices in a list (A[-1] means A[len(A)-1]). This makes it easy to implement dynamic programming with negative indices. When the index can take values from -L to L, prepare a dp array of length at least 2*L+1. In this array, information on positive indices can be placed in the first half of the list, and negative indices in the second half ([0, 1, 2, 3, ..., L, ... , -L, ..., -3,-2,-1]).

Source Code for D:

mod = 998244353

n = int(input())
a = list(map(int, input().split()))
dp = [0] * 2 * 10**5
dp[a[1]] = 1

for i in range(2, n):
    ndp = [0] * 2 * 10**5
    for j in range(-90010, 90010):
        ndp[j + a[i]] += dp[j]
        if j != 0:
            ndp[j - a[i]] += dp[j]
    dp = [j % mod for j in ndp]

print(sum(dp) % mod)
»
3 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Could someone tell me a test where my code fails?

https://mirror.codeforces.com/contest/1783/submission/188507888

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

188508171 Please show me a case where my submission for problem C get the wrong answer :((((

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

The hack channel for problem C is ridiculous. If I set t to 1 and n to 500000, it will show generator crashed, which means it is hard to hack it tle!!!!!!!!!!!!!!!

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

Quite an ambiguous definition+example of the side adjacency for problem B. In the 2x2 example almost any nonsense one may come up with yelds same answer. For example if you define side adjacent elements as "elements on the same matrix edge". After the clarification it gets better, but still there's a chance you keep solving the wrong task on impulse.

Any ideas how this "insanely misinterpreted" problem can be solved by the way?

Once again. Same task: find the most beautiful matrix, but the adjacency definition is:

Two different matrix elements $$$a[i_1][j_1]$$$ and $$$a[i_2][j_2]$$$ are adjacent iff ($$$i_1 = i_2 = 1$$$ or $$$i_1 = i_2 = n$$$ or $$$j_1 = j_2 = 1$$$ or $$$j_1 = j_2 = n$$$) ?

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

can anyone tell me how to solve E?I Just know that for every a[i]>b[i],then check k is ok if and only if (a[i]+k-1)/k==(b[i]+k-1)/k (i.e. ceil(a[i]/k)==ceil(b[i]/k)). but this get TLE as expected. how to get a faster solution? i cant understand the solution in the front row

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

can anyone tell me how to solve E?I Just know that for every a[i]>b[i],then check k is ok if and only if (a[i]+k-1)/k==(b[i]+k-1)/k (i.e. ceil(a[i]/k)==ceil(b[i]/k)). but this get TLE as expected. how to get a faster solution? i cant understand the solution in the front row

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

In problem C, does NlogN pass? I didn't want to take a risk and made an O(n+maxA) solution.

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

can anyone help me understand in problem C if the test is 8 6 2 2 2 2 2 2 2 2 so if I win against the 8 and 6 and 4 so 1 1 win 2 2 win 3 3 win 4 3 win 5 5 win 6 5 win 7 7 win 8 7 win I 3 win so I should rank 3 why is the answer 5 I don't understand I got stuck in this problem for that

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

    just because there are 4 people whose win count strictly larger than you (i.e.5,6,7,8),let the count called k. and the answer is k+1. I guess you misunderstood the computing method of the rank within this question.

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

    Because rank is the no. of people with more wins than you + 1. Your win count is $$$3$$$ but $$$8$$$ and $$$7$$$ both have won $$$7$$$ and $$$6$$$ and $$$5$$$ both have won $$$4$$$, hence the no. of people with more wins than you is $$$4$$$. Therefore, your rank is $$$5$$$

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

    It's optimal to beat the any 2 players and the 4th player which results in 3 wins.

    Bracketed players are the ones we beat.

    So 2 2 2 [2] 2 2 [2 2]
    

    And then if we count the number of wins and also consider the players we lose to we get our answer.

    1st player will have 0+1 wins
    2nd player will have 1+1 wins
    3rd player will have 2+1 wins...
    4th player will have 3 wins
    5th player will have 4+1 wins
    6th player will have 5+1 wins...
    7th player will have 6 wins
    8th player will have 7 wins...
    

    We ourselves have 3 wins. Order looks something like this then

    P(i) = 1 2 3 4 Us  5 6 7 8
    Wins:  1 2 3 3 [3] 5 6 6 7
    

    Our rank is 5.

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

BledDest Can anyone explain problem C?

For this test case

4 4

1 2 2 1

Since we have 4 minutes I can defeat Opponent 1,2. But why in the explanation it is mentioned we can win against only opponent 1 and we have no time to prepare

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

I almost spent the same amount of time on B as I did on C and D combined.
Seemed like I was solving some weird newspaper puzzle.

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

    How is B an 'edu' problem?

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

      I start to think that "edu" is not about learning, "edu" is about Harbour space, like , there are Pinely rounds, Polynomial Round, CodeTON Round etc.

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

      It is rarely a difference between EDU and classic rounds. EDU were immature rounds initially, with no score distributions and possibilities for hacking, but later classic rounds overcome simplification and become similar to EDU, without hacking almost, but still with different costs of problems (except newer Div.>2, which are simplified further and have no difference with EDU).

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

      It's not a random guessing problem. Notice that the difference is between 1 and $$$n^2-1$$$, so naturally we first try to get them all. For $$$n^2-1$$$, $$$n^2$$$ and 1 need to be adjacent, then for $$$n^2-2$$$, either $$$n^2$$$ and $$$2$$$ or $$$n^2-1$$$ and $$$1$$$ need to be adjacent, .... It's quite easy to achieve that. If you know gray code, Z-order, or something like those, easier.

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

Solution of D(with explaination please)?

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

This was a perfectly good round, without any major errors. Why all the downvotes?

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

Though the binary search solution greatly simplified the task, was it actually required in C?
I mean, apart from the edge case of losing to the winner and changing the required score, it was all greedy and sequential, right?

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

There is interesting solution of E with Eratosphens sieve: It's a fact that upper bound of a[i] / k must be <= upper bound of b[i] / k for all i. So we need to check only pairs where a[i] > b[i]. You can increase every a[i] position by any big number (1e7 + 1 in my case) and decrease every b[i] position by 1. Then we get prefix sum of this array and iterate like in sieve. If any sum on prefix with length which divides k doesn't divide 1e7, it means that we found some b[i] with b[i] / k > a[i] / k. That's it: 188522674

UPD: nevermind lol, it's basic solution

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

For problem D, I submitted these 2 solutions after the contest:

Submission 1 gives a Wrong Answer verdict. 188541769

But when I submitted a new solution taking the answer modulo, I got a TLE verdict. 188542103

I don't think I changed much of my code. Does anyone know what the heck is going on?

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

problems are good , but the implementation part is a bit complicated.

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

For D problem,can we use dfs and work it out?

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

Apparently I crashed codeforces because of a hack submission I made. I don't even remember the testcase I did, but it was supposed to bug a code that was using random generator for the answer. Anyway, thought I would leave that here so someone would look through it and see why it's still waiting for about 10 hours now!!

Here is the link to the hack: https://mirror.codeforces.com/contest/1783/hacks?verdictName=TESTING&chosenProblemIndex=A

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

Will we see rating update and tutorial before next contest begins?

Why does "Educational round" mean slow rating update and slow tutorial?

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

How to solve G ? Seems that the tutorial won't be soon :(

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

Wait for D's solution.DP is my weakness...

And there is still no tutorial yet?

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

I dont understand why this contest was downvoted, I felt like problems were good, specially C.

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

I'm wondering how 300*2*300*300 solutions were accepted for D. Thats like (10^8)/2. Aren't 10^8 solutions supposed to TLE?

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

B is worst problem fck

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

Has anyone tried to submit B using simulated annealing? I tried but it gets WA: 188572639

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

Rating??

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

When is system testing going to happen?

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

Trush round!A is not perfect.Problem B is the worst problem I have ever seen.I wasted an hour on it.But C is very interesting.Hope more questions like C will appear in cf.

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

Why it's taking time to get the rating updated for this contest?

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

Where the rating updates at?

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

any tutorial?

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

When will the tutorial will be published ?

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

has this contest been declared unrated or what? why rating is not updated yet?

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

    It takes so long in Educational Rounds

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

      Yes, and 4 hacks are not tested yet. All that hacks are on this solution, it has random and easily gets TL. I dont know why testing solutions on hacks dont break after TL...

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

        But in fact this code is expectly $$$O(Tn^2)$$$ in the worst cases,which is easy to pass.I didn't understand why it can be hacked(I submitted a same one and was hacked),could someone tell me?

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

          I don't know about TLE, but does random give 100% correct answers?

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

          If you have array [1, 1, 1, 1, ... , 2] you have 2 correct answers — [1, 2, 1, 1, ..., 1] or [2, 1, 1, 1, 1, ..., 1]. In this case you have n possible permutations of array, so in each random shuffle you have only 2 correct answers from n, where maximal n = 50.

          if you do K random shuffles, probability of your win would be correct positions / all positions. All positions = n ^ k, correct positions = all positions — bad positions = n^k — (n-2) ^ k. So if you do K random shuffles probability of finding correct answer is

          P = (n^k — (n-2)^k) / n^k.

          For n = 50:

          • if k = 5, P = 0.1846273024

          • if k = 10, P = 0.33516736

          • if k = 100, P = 0.98312968

          So on this testcase it does 100 shuffles for finding answer. So your code does t * n * K = 2000 * 50 * 100 = 1e8 operations, and you choosing random number 1e8 times for shuffling array, and this can take long time and maybe TL.

          If you would find testcase where is only one correct permutation:

          P = ((n^k) — (n-1)^ k) / (n^k)

          • if k = 5, P = 0.096079

          • if k = 10, P = 0.182927

          • if k = 50, P = 0.635830

          • if k = 100, P = 0.867380

          • if k = 200, P = 0.982412

          In this case your code does t * n * K = 2000 * 50 * 200 = 2e8 operations

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

            Yeah I thought just like you,but I tried to use $$$2000,50,1 1 1\cdots 2$$$ to hack it,but it ran very fast,just used 93ms!

            link

            And I just found the all the data hacked my submissions satisfied that $$$n$$$ is small(In fact,$$$n=4$$$). I'm a bit confused about it.

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

            I just wrote a random algorithm as it.

            188610805

            I guess that randomize in the hacked code is the murderer of it.

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

              Yes, randomize function is bad and slow.

              When you tried to hack his solution it's not guaranteed that his random would use 100 operations — maybe if he would lucky he can find correct answer in 5 or 10 attempts.

              About test that hacked your code, i dont really understand why it failed, because for n = 4 and k = 5, P = 0.96, so you need on the average 5 attempts for shuffle, so I dont know why it got TL...

              I will try your solution in locale on testcase which hacked your solution, if I would find something interesting I will write you in messages.

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

          It was me who hacked it. Sorry xD

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

The contest is supposed to be rated right?

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

Can anyone explain how to solve problem F?

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

    We will post the official editorial in one or two hours. Here's an explanation of F copied from it.

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

Why am i not t rated?

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

Why do the ratings not still updated.Is any cheater caught or something else.Please update the ratings soon. Thankyou!!!

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

MikeMirzayanov Why am i not rated? Please update the ratings soon. Thankyou!!!

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

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

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

Thanks for the Editorial :) Can anyone say why ratings are still not updated?

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

When will the system testing is going to start?

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

Sorry, this is my fault. I completely forgot about judging this round, I just somehow got distracted and flew out of my head. Is it old age? Soon the round will be re-judged taking into account hacks and then take care of the rating!

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

Why rating update before next contest is important?

Some people are on boundaries of getting new color to profile...they becomes aware before their upcoming contests and prepare as per that situation....

Some might think to get good ranks in div3

Some might think that educational rounds are easy ...let's try for that and can skip some contest

Some might have got good rank and might be eager for announcements....

One of my friend won't eat food if contest not goes good....coding is turning someone emotion...❤️..

Wow that's fantastic to listen it and get ready for coding...!

We salute to efforts of all coding platforms...!! for making coding as emotion

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

First time I “FSTed” with a later accepted time

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

is this round unrated?

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

Can anyone say why the given ratings are rolled out?

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

Why the Rating of this contest changes and suddenly changes back these days?

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

Why this contest is unrated?

or it's not unrated?

thanks!

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

Why my rating is not updated?

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

if someone is struggling with understanding problem-B, the key observation is there should be a number which can be completely absorbed into rest of the numbers. i.e. there is an a[i] whose set bits are [x1, x2, x3] and aj has set bits [x1, x3] and a[k] (k!=j && k!=i) has set bits [x2, x4, x5] then seq-a would be all elements in array and seq-b would be all elements in array except a[i] since those set bits already exist via rest of the elements