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

Автор vovuh, история, 5 лет назад, перевод, По-русски

На этот раз мне нечего сказать, так что встречайте еще один Div. 3 раунд :)

<almost-copy-pasted-part>

Привет! В 14.05.2019 17:35 (Московское время) начнётся Codeforces Round 560 (Div. 3) — очередной Codeforces раунд для третьего дивизиона. В этом раунде будет 6 или 7 задач (или 8), которые подобраны по сложности так, чтобы составить интересное соревнование для участников с рейтингами до 1600. Наверное, участникам из первого дивизиона они будут совсем не интересны, а для 1600-1899 покажутся простыми. Однако все желающие, чей рейтинг 1600 и выше могут зарегистрироваться на раунд вне конкурса.

Раунд пройдет по правилам образовательных раундов. Таким образом, во время раунда задачи будут тестироваться на предварительных тестах, а после раунда будет 12-ти часовая фаза открытых взломов. Я постарался сделать приличные тесты — так же как и вы буду расстроен, если у многих попадают решения после окончания контеста.

Вам будет предложено 6 или 7 (или 8) задач и 2 часа на их решение.

Штраф за неверную попытку в этом раунде (и последующих Div. 3 раундах) будет равняться 10 минутам.

Напоминаем, что в таблицу официальных результатов попадут только достоверные участники третьего дивизиона. Как написано по ссылке — это вынужденная мера для борьбы с неспортивным поведением. Для квалификации в качестве достоверного участника третьего дивизиона надо:

  • принять участие не менее чем в двух рейтинговых раундах (и решить в каждом из них хотя бы одну задачу),
  • не иметь в рейтинге точку 1900 или выше.

Независимо от того являетесь вы достоверными участниками третьего дивизиона или нет, если ваш рейтинг менее 1600, то раунд для вас будет рейтинговым.

Спасибо MikeMirzayanov за платформы, помощь с идеями для задач и координацию моей работы. Спасибо моим очень хорошим друзьям Михаилу awoo Пикляеву, Максиму Neon Мещерякову и Ивану BledDest Андросову за помощь в подготовке и тестирование раунда.

Удачи!

Также хочу сказать, что участники, намеренно отправляющие неверные решения и взламывающие их после окончания соревнования (пример), не будут показаны в таблице лидеров по взломам.

</almost-copy-pasted-part>

UPD: Я также хочу поблагодарить nhho, chenjb и ksun48 за тестирование раунда.

UPD2: Я также хочу поблагодарить моего друга Адилбека adedalic Далабаева за важные предложения по поводу контеста и его тестирование!

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

UPD4:

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

Место Участник Задач решено Штраф
1 nuoyanli 7 368
2 Vaseline_Warrior 7 437
3 adimiclaus15 7 446
4 smallguoguo 7 604
5 leo990629 6 335

Поздравляем лучших взломщиков:

Место Участник Число взломов
1 Java 68:-2
2 figdan 63:-13
3 makjn10 44:-1
4 csts.21 40
5 shubhammitt 27
Было сделано 872 успешных и 341 неудачных взломов.

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

Задача Участник Штраф
A firefoooox 0:03
B CoolAttacks 0:03
C igniubi 0:08
D foool 0:13
E i_love_math 0:15
F1 cunt 0:27
F2 cunt 0:26

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

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

Isn't the 12-hour hacking phase an overkill? I mean because most of the hacks are done within the first 6 hours or so.

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

    Of course not, the hacking phase starts at 0:35 in Hong Kong, but I'm a lazy guy who wakes up at 12:00 everyday XD.

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

    do you now one time in edu contest i submit a code that shoud get TLE but after hours nobody hacked me
    so i said to one of my freinds that my code is wrong after that he hacked me :\ the cool thing is that i submit that code with another handle and it got AC ;\

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

I have nothing to say this time, ... I also would like to say that participants who will submit ...

Just kidding :)

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

    Honestly, I understood the meaning of your joke only a couple of minutes after downvoting your comment XD XD XD

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

Hope there are no server issues this time .. xD

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

The third category is good for people whose level is poor because it easier more than the second category

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

Vovuh's Division 3 Rounds are usually balanced and contain interesting problems, I hope this contest lives up to that standard as well! Good Luck To All Participants!

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

fine

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

was my best contest ever..solved 5/7 . please dont hack me .

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

    How did u solve D?(I've got WA on 32nd testcase and I am mad).

    • »
      »
      »
      5 лет назад, # ^ |
        Проголосовать: нравится +2 Проголосовать: не нравится
      1. sort the almost divisor list
      2. check if it satisfies. lets say our number X. divisor[i]*divisor[n-1-i]==X
      3. count the number of almost divisors of X. it must be equal to n.
»
5 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

So, are we allowed to discuss problems during 12 hour phase?

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

Can anybody explain E,please?

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

    Greedy. First you have to calculate appearance of each $$$a_{i}$$$ and multiply it with $$$a_{i}$$$. Then sort both of arrays and reverse $$$a$$$ (or $$$b$$$). Answer is $$$\sum\limits_{1 \le i \le n} a_{i}*b_{i}$$$

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

    Think in fixed values, the array $$$a$$$ and how many times the number $$$a[i]$$$ (0 index base) appears in the sum expression, so you can create an new array $$$staticval$$$. Note that $$$staticval[i]=a[i]*(n-i)*(i+1)$$$ for each $$$0 \leq i \leq n-1 $$$, then you arrangue the $$$b[i]$$$ values as you need (sorting $$$b$$$ and $$$staticval$$$), note that $$$staticval$$$ array have values less than $$$10^{18}$$$, so you always can obtain the answer.

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

      Hey. What is the problem in my solution? Here is the code: Code.

      I sorted a in ascending and b i descending order and Multiplied corresponding elements . Sorted back the product in order of corresponding elements of array a. Finally I printed the summation(f(l,r)) for 1<=l<=r<=n in O(n). Please explain :)

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

    Assume that you have the optimal array as C. So we have to find the minimum of \sum_{i = 1}^n(i)*(n-i+1)*a_i*c_i (This is because the i'th element will occur when l can be anything from 1 to i and r can be anything from i to n so i'th element will occur in i*(n-1+i) number of times). So we can rearrange b_i to form C. So to get the total minimum sort the modified A array where a_i = a_i * i * (n-i+1). and array B. And then for the minimum multiply a_i & b_{i-1}. Here is the code for this.

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

In D what is input when ans is -1 ?

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

    for example: 1 2 2 8

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

      We can't have 1 2 2 8 as test case because 1.all factors given are distinct 2.1 or the actual x is not given in the factors list

      You may Consider Sample case where factors are: 2 3 4

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

      I don't think that's a valid input array. I think it's more along the lines of 4 8.

      The answer to this is -1 because whatever number is divisible by 4 and 8 must also be divisible by 2, yet 2 is not in the input array.

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

        i am confused. if all factor has given except 1 and x then 2 should be in input. please clear it to me.

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

How to construct array in Problem E such a*b is minimized?

I tried by first taking frequency of each element in final answer which for each index i came out as i*(n-i+1). This is increasing and then decreasing sequence. So for final array, we can take smallest b value at middle position and distribute b by moving from the center of array a. But this approach seems incorrect since it gets wrong on given first test case itself.

How to construct the array so that final sum is minimized?

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

    multiply a[i] with its query frequency, sort the two arrays in reverse order of each others then calculate sum of a[i]*b[i]

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

    -i constructed mul[i] array as the freguency of each element times a[i], mul[i]=a[i]*(n-i)*(i+1) {my i starts from 0}; -then sorted mul[], and b[] -reverse b[] -k=(k+b[i]*mul[i])%M

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

    Assume that you have the optimal array as C. So we have to find the minimum of \sum_{i = 1}^n(i)*(n-i+1)*a_i*c_i. So we can rearrange b_i to form C. So to get the total minimum sort the modified A array where a_i = a_i * i * (n-i+1). and array B. And then for the minimum multiply a_i & b_{i-1}. Here is the code for this.

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

I dont feel like having anything learned from these problems. Its just understanding difficult language and fiddling with indexes. Not the fun stuff.

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

What is wrong in my code guys? Can you help me? Its about problem E: https://codeforces.com/contest/1165/submission/54136675

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

It's my first codeforces contest. Can anyone please explain to me what is this hacking period?

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

what's the approach to solve C please?

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

    Start in the first position anf, greedly, start checkin if s[i]==s[i+1], if its equal, erase s[i] and chande the odd positions to even positions, this is the answer if the string is even, otherwise, erase the last position

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

      Any proof?

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

        @Alphatrance

        It is required if you have elements starting from odd position, say xxxxy, that next element must be different. So its gauranteed to delete one of the above 4 possible x. Even if you delete first 3 x, you have last x, come into original position in the new string, as you would have deleted the last 3 x.

        Also, If you move from left to right, deleting, you gaurantee that that prefix will always be a good string, irrespective of what happens in the next part.

        Thus the greedy approach follows.

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

        Suppose that i is the least position at string s that s[i]==s[i+1] and i is odd. If you dont erase it, or the next element, you will never change the parity of the positions <= to i and you will never erase them, so you have to erase all the positins from the beggining with the conditions of the problem.

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

    for every odd index, if(str[i]==str[i+1]) just remove str[i]

    after that, if str.size() is odd then remove last index

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

I had the following strange issue when sorting in Java:

In both problem B and E, I got TLE when using Arrays.sort but AC when using Collections.sort. Has anyone else encountered this problem?

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

    I have encountered it too. I didn't try Collections.sort(). I'm getting mad. Just can't understand why Arrays.sort() gives time limit exceeded verdict.

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

    Arrays.sort() uses the quicksort algorithm, whose worst-case running time is O(n*n). The other day one of my solutions for a Div.3 problem was hacked because someone created a counter test on Java's sort method, from this time on I coded a custom mergesort function with guaranteed O(n log n) performance.

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

      Ah, cheers, you're absolutely right (see this article). However, I don't think you have to code your own sorting algorithm since, apparently, the worst-case time is O(n log n) when sorting objects.

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

        Well, it's just 30 lines of code that I copy-paste, and more often I sort primitive types (in problem E, where I used mergesort, I sorted an array of longs).

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

          That's a good point. Alternatively, one could use Long instead of long.

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

            Well, the overhead is rather high when you have big input data, it's faster to simply mergesort and forget about it :)

            In contests like Google Code Jam, it's much less of a problem, since the TLs are on the order of 15s, enough to make an unoptimized solution fail, but high enough to allow slight low-level inefficiency like the one you mentioned (Long vs long). And no one tries to come up with a corner case for Arrays.sort()

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

    In my job I am practicing java and I am facing...

    tmg-article-tall

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

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

Here is a quick editorial

A

Спойлер

B

Спойлер

C

Спойлер

D

Спойлер

E

Спойлер

F

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

    your E is wrong you shouldn't mod after multiplying with frequency

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

    You cant % array A before sorting, it gave me Wrong Answer ...

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

    In problem F, on i th day can i order more than 1 types of micro-instruction?

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

    For problem D can someone explain the formula for the number of divisors? p1^e1 * p2^e2 * ...

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

      Suppose, N be a number. Then N can be written as follows:

      N = p1^e1 * p2^e2 * p3^e3 * p4^e4 * ......... * pk^ek

      This is called prime factorization of N. Now, if 'd' is a divisor of N, 'd' shouldn't contain any other prime except (1 <= pi <= k). And the power of pi should be within (0 — ei).

      so d = p1^b1 * p2^b2 * p3*b3 * p4*b4 * .........* pk^bk, where, 0<=bi<=ei

      For a single prime it can be present in a divisor in (ei+1) ways [ pi has power from 0 to ei ]

      so total number of divisor (NOD) = (e1+1) * (e2+1) * (e3+1) * (e4+1) * ...... * (ek+1)

      I hope its clear to you. :)

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

    I have a small doubt in this problem F1,F2. Can we buy more than one types of microtransactions in a single day? e.g. 1 of type 1, and 1 of type 2 etc. Or its just that we can buy any number of any SINGLE microtransaction each day?

    From your code it seems that we can actually buy multiple types. But this was not that clear from the problem statement.

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

    In F the question doesn't ask us to keep the money spent minimum, so why don't we buy all type on the first day?

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

2nd test case of D problem Ruined my contest.

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

shouldn't E be solved this way ?:

first sort a, and b array. Then by rearrangement inequality, minimum order must be a1b1 + a2b2 + .... .

Then for effective (O(n)) calculation, I used this (where pr[n] = a1 + a2 + ... a3, ... i.e. prefix sum)

    fr(i, n){
        ans += ((((1ll*pr[i+1])*(1ll*b[i]))%mod)*(n-i))%mod;
    }

which I think is correct formulation, but its giving me 643 instead of 646 for 1st test case. Can someone help please?

Thanks.

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

    Read the problem.

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

    It's because you are not allowed to permute array a, only b. There are also other errors with your solution. You are not adding to the final answer correctly. Check this.

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

    do exaclty the same but not sorting A before you do the algorithm above

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

    rupav Sort A after multiplying with the coefficient (i*(n-i+1)) i.e. Sort the Array ModifiedA where ModifiedA[i] = A[i]*i*(n-i+1).

    See this solution.

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

Good Round with strong pretests. Thanks vovuh

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

I use binary search to solve B, I use std::lower_bound got correct 54118173 ,but I try to use std::set::lower_bound got incorrect 54110418, could somebody tell me why...ORZORZ

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

What kind of test cases are being used to hack A?

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

This contests was good except for weak pretests. For example I was hacked on A, and I know why I was hacked. I am surprised that pretests didn't catch this simple bug and my rating is going to suffer. I am dissapointed.

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

Great round with great problems! No issues with the servers either. Thank you

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

"I tried to make strong tests." While I believe this is true, I don't believe much thought or time went into them as seen by how many people were hacked on A. I know that Vovuh does many rounds but maybe he should take some time before finalizing it.

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

time to change the name of codeforces to hackforces ...

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

Did anyone notice the number of submissions of F1 is exactly equal to the submissions of F2.

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

Strong tests !! Is the meaning of strong has been changed lately ?

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

Is E polinomially solvable if we are allowed to permute both a and b ?

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

Can anybody explain the first sample input/output of problem E ?

Input:

5
1 8 7 2 4
9 7 2 9 3

Output:

646

The problem statement isn't clear to me :)

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

    If you reorder the elements of b in this way:

    9 2 3 9 7
    

    You'll have the next sums:

    $$$ f(1,1) = 9, f(1,2) = 25, f(1,3) = 46, f(1,4) = 64, f(1,5) = 92 $$$

    $$$ f(2,2) = 16, f(2,3) = 37, f(2,4) = 55, f(2,5) = 83 $$$

    $$$ f(3,3) = 21, f(3,4) = 39, f(3,5) = 67 $$$

    $$$ f(4,4) = 18, f(4,5) = 46 $$$

    $$$ f(5,5) = 28 $$$

    Then the total sum will be:

    646
    

    P.D. I hope this has helped you better understand the test case.

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

weak pretest:(

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

Is there any Pending System Testing now also?

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

Is this contest unrated? Because my rating is not updated yet, and my rating is less than 1600.

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

Im about task D. Why the answer for this test is 9, not 6? k = 1, n = 1, d1 = 3.

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

    For 6, the almost divisors will be 2, 3. Whereas 9 will only has 3 as almost divisors.

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

the first problem data is so easy I was hacked:(

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

Where is editorial ?? What about system testing ??

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

Is this contest unrated?Why I don't get rating changes?

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

System Test has finished?

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

Can someone post a solution in Python for "D — Almost All Divisors" without "Time limit exceeded on test 4"?

Or show me error in my code https://codeforces.com/contest/1165/submission/54168485

Updated 1: Fixed logical errors, still TLE

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

When system testing will be done for the contest??

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

when will contest ratings are going to be given ?

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

Is contest rated or not?

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

when will our ratings will come?

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

When will the rating change come out?

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

MikeMirzayanov Ratings are not updated yet ...Pls look into the matter

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

this round unrated??

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

admins, plz press the start system test button

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

RATING CHANGE IS OUT ! ON THE RIGHT OF STANDINGS !

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

even system testing is not done.

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

Press the button.

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

FINALLY !!!

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

I have a question in problem D, I have the same ideas

  1. sort the divisors
  2. make them all ans = ans * divisor[n] / __gcd(ans,divisor[n])
  3. if ans = MaxDivisor , ans *= MinDivisor , then list all the divisors of new ans.

but I've got WA on test 5, and after some tries finally WA on test 6,I really feel frustrated . Could someone tell me why my code is wrong?54168335

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

    Just try for find countertests.
    1
    3
    3 4 9

    Your output: 36
    Right answer: -1

    P.S. Try to check found number for correctness before printing.

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

Why is the test so slow?

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

Please tell why my approach for Problem E is incorrect?

My Solution: https://ideone.com/tBe1up

I am also doing like mapping max value of a with min value of b and so on. And then calculating the answer using dp like dp[i] denotes the answer for ai and bi arrays till index i.

Please tell, I can't figure out the same.

Editorial is doing the same thing for vali as given.

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

    Make your code readable and ask again

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

      Don't know why it was not readable. I made it public. Try this: https://ideone.com/tBe1up

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

        he means your code has too much define and others may not understand

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

          It is not much of define.

          ll means long long

          and fl(i,a,b) means for loop with range [a, b)

          and slld(a) means scanf("%lld", &a)

          Just this.

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

            I think mapping arrays $$$a$$$ and $$$b$$$ it's not enough, you need to map the array $$$a'$$$, that $$$a'[i]=a[i]*cnt*(n-cnt+1)$$$

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

              That's what I am asking. Why?

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

                $$$a=[4, 3, 2, 1, 2, 3, 4]$$$; $$$b=[1, 1, 1, 1, 1, 1, 1]$$$ sorting $$$a$$$ you get: $$$a=[1, 2, 2, 3, 3, 4, 4]$$$ so you $$$a[i]*b[i]$$$ is the same as $$$a$$$ finally, you have $$$ans=[1*7, 2*12, 2*15, 3*16, 3*15, 4*12, 4*7]$$$ but the answer is: $$$resp=[4*7, 3*12, 2*15, 1*16, 2*15, 3*12, 4*7]$$$ as you can see, it's not enough mapping $$$a$$$ and $$$b$$$

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

                  phibrain How did you came up with this thinking of using vali instead of ai, by using some test cases only or any other thing?

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

                  It's just a counterexample of a possible solution, so it's not hard to got that.

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

My rate didn't change yet Why?

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

Sorry for criticizing, but frankly I don't think Div 3 problems are easier than Div 2 in any sense.

Div 3 problems are implementation tasks and costs serious debug time, and this time Div 3 A is harder than Div 2 A (#559) imo. Other problems are also annoying implementations which I fail to debug quick enough to get a high rating.

Div 2 is generally a more relaxing coding experience for me, to calm down and think of ways to optimize to AC, but Div 3 is just me frantically debugging. 4 questions in Div 3 to increase rating is rusher than 3 in Div 2, don't we think?

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

Problem E- Can anyone please explain why that while using

long long int yyy=(n-i)*(i+1); a[i]=a[i]*yyy;

produces an error in https://codeforces.com/contest/1165/submission/54228312

whereas simply writing - a[i]=a[i]*(n-i)*(i+1) gets an AC

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

I was the first one to solve problem E, yaaay! yaaay!