Изменения рейтингов за последние раунды временно удалены. Скоро они будут возвращены. ×

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

Привет, Codeforces!

В Apr/22/2019 17:35 (Moscow time) состоится Educational Codeforces Round 63 (Rated for Div. 2).

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

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

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

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

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

А вот сообщение от наших друзей из Harbour.Space:

Hi Codeforces!

This summer, we want to invite you to Tech Scouts, the two-week summer camp we run from the 8th-19th of July in one of Barcelona's leading international schools, St.Paul’s.

This camp, divided into Creative and Technical tracks, is designed to lay out the foundation of knowledge for high-school students in the fields of technology, mathematics, business and design. Both tracks are taught in English.

We would love to see you guys at our camp this year — if you’re interested in joining, or if you just want to know more, just head over to the Tech Scouts website.

This camp is for anyone passionate about tech or design, so if you know someone who might be interested, be sure to let them know too!

Ps. Don’t wait too long — you still have an early bird discount, but only until May 20th

UPD: В раунде будет 6 задач.

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

Место Участник Задач решено Штраф
1 Um_nik 6 111
2 Cirno_9baka 6 207
3 Ilovebxy 6 247
4 ivan100sic 6 249
5 ainta 6 411

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

Место Участник Число взломов
1 halyavin 292:-18
2 Haunted_Cpp 31
3 achaitanya.sai 30:-4
4 Disappointment 27:-1
5 czasem_tak_trzeba 23
Было сделано 790 успешных и 697 неудачных взломов.

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

Задача Участник Штраф
A iaeyoayao 0:01
B MesyuraTheOldDumbGoblin 0:03
C Nazikk 0:07
D JettyOller 0:07
E Rezwan.Arefin01 0:17
F Um_nik 0:59

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

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

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

Good luck to everyone tomorrow! Nice time by the way!

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

Why does awoo sets problem mostly for educational rounds only ???

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

Hope to we all have a good luck , with no hacked submissions!

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

It'll be held at 22:35. I've never stayed up late for a contest XD.

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

what do u mean by "systems Polygon " ? " thanks to Mike MikeMirzayanov Mirzayanov for <> and Codeforces."

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

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

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

Good Luck Everyone :)

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

Give me that +12 rate change:)

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

m2.codeforces shows 500:Internal Server Error. m1,m3 also not working. Please fix.

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

halyavin is here.

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

.

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

How to solve E, are there some observations or it's an application of some algorithm?

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

    I was thinking it could be solved by solving System Linear Equation with Gauss Jordan with modules. But I failed in the implementation...

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

    I checked x=0,1,2,3,4,5,6,7,8,9,10. And then calculated all values using Lagrange interpolation.

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

    A $$$N$$$ degree polynomial is uniquely determined by $$$N+1$$$ distinct evaluations. You can ask $$$P(0), P(1), \cdots, P(10)$$$ and then interpolate. Then you can find the root in $$$O(mod)$$$ by checking all numbers in $$$[0, mod - 1]$$$.

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

      So, the interpolation would return the coefficients and then we bruteforce over all the values for the function we've found?

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

      Technically $$$O(mod \log mod)$$$ for me bcz my interpolation involved finding the inverse of each $$$n$$$ with $$$0<n<mod$$$.

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

        My interpolation required inverse of numbers in $$$[0, 11]$$$, which you can precalculate in $$$O(1)$$$ using $$$inv(i) \equiv -(M / i)\cdot inv(M \mod i) \pmod M$$$:

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

        Calculating inverses of all elements in modular ring can be done in $$$O(mod)$$$. Refer last section of https://cp-algorithms.com/algebra/module-inverse.html .

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

    Just ask for $$$f(0), f(1), ..., f(49)$$$, pray there is some recurrence like $$$f(i) = \sum_{j} a_j \times f(i - j)$$$. and find it using Berlekamp-Massey. Then you can calculate all $$$f(i)$$$ for $$$0 \le i < MOD$$$. The existance is proved here.

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

    I used little Bézout's theorem. For any $$$a$$$ we have $$$f(x) = g_1(x) \cdot (x - a) + f(a)$$$, where $$$g_1(x)$$$ is a polynomial with less degree. So if we know $$$f(x)$$$ and we have asked for $$$f(a)$$$ before we can calculate $$$g_1(x)$$$.

    You can continue, say $$$g_1(x) = g_2(x) \cdot (x - b) + g_1(b)$$$, and so on, remembering the remainder on each step. After a few iterations (about $$$10$$$) $$$g_i$$$ will become a constant function.

    If we know $$$g_{i + 1}(x)$$$ we can easily find $$$g_i(x)$$$. So, since we know that for big enough $$$i$$$: $$$g_i$$$ is constant, for any $$$x$$$ we can caluclate $$$f(x)$$$ by going backwards through these functions.

    Now just iterate through all $$$0 \le x < 10^6 + 3$$$ and check if $$$f(x)$$$ is zero.

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

What is the solution to F?

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

      It's "minimal", not "minimum". "minimum" is NP-hard, hence the limit.

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

        Sorry for my english, but what is the difference between "minimal" and "minimum" in this case?

        Thank you!

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

          It is a mathematical notation.

          For set $$$S$$$, a subset $$$X \subset S$$$ is "minimal" set satisfying certain property if there exists no other subset $$$Y \subset S$$$ such that $$$|Y| < |X|$$$, $$$Y \subset X$$$, and satisfies such property.

          For set $$$S$$$, a subset $$$X \subset S$$$ is "minimum" set satisfying certain property if there exists no other subset $$$Y \subset S$$$ such that $$$|Y| < |X|$$$ and satisfies such property.

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

    DP on subset of vertices. Note that 2-edge-connected graph admits an ear decomposition. Thus, the base case is where the graph admits a Hamiltonian cycle. For the inductive case, you split the set into two parts: One for the new ear, other for the minimum biconnected subgraph of remaining sets.

    The time complexity is $$$O(3^N \times N^2)$$$ because you enumerate subsets for each subset. My code is pretty slow, and I think it could be done faster, something like $$$O(3^N \times N)$$$.

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

      I think you can precalc bunch of stuff in $$$O(2^{n} poly(n))$$$ and then get $$$O(3^{n} \cdot \frac{n^{2}}{64})$$$. My solution from the contest also works in $$$O(3^{n} n^{2} + 2^{n} n^{3})$$$, but the constant factor in first part is very small ($$$1/54$$$ easily), I even think that precalc is the slowest part of my solution (I store all the paths for some reason, so it is $$$2^{n} n^{3}$$$ pushbacks, you don't need it actually).

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

    Randomized solution also works. If we fix the DFS tree of the graph, it is easy to choose minimum number of back-edges to make the graph bi-connected. (It can be done by simple dfs+greedy, in O(N+M)) So, we run the following iteration as many as can: 1. make a random DFS tree of the graph. 2. run greedy on that DFS tree to find minimum edge set. then print the best solution.

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

    Here's my solution:

    For each subset of the set of vertices, try finding a simple cycle which contains only those vertices, this can be done in $$$O(n^3 2^n)$$$. If there is a Hamiltonian cycle, then it is the solution. Otherwise, pray that there aren't many subsets of the set of vertices such that they form a cycle, and then do DP on them: I assumed that the solution will always be a union of such cycles. (I didn't prove it but it makes sense). The complexity of this part is $$$O(\frac{n^2 2^n C}{32})$$$ where $$$C$$$ is the number of cycles.

    Code: 53156325

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

Problem D case 5?

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

Any hints for E?

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

    Finding the constants of the polynomial by solving linear equations (notice or google that 10^6+3 is a prime so it forms a field Zp) and then brute forcing on the polynomial as the degree is <=10 .

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

How to solve D ?

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

    dp[i][0..2] mean haven't multiplied by x, have been multiplied by x, have multiplied x. So we have follow:

    dp[i][0]=max(dp[i-1][0]+a[i],a[i])

    dp[i][1]=max({dp[i-1][0]+a[i]*x,dp[i-1][1]+a[i]*x,a[i]*x})

    dp[i][2]=max({dp[i-1][1]+a[i],dp[i-1][2]+a[i],a[i]})

    the answer will equal to one of the dp array

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

      I think the last transition is wrong. In dp[i][2] you can't start a new segment. EDIT: Well, it is correct I guess, as the problem allows not multiplying x at all. But it is wrong for the dp definition.

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

        You are right, but the value won't be wrong because the dp[i][2] value was equal to dp[i][0] at that time

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

      Brilliant approach, thanks! It helps me a lot.

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

      I let dp[i][j][k] mean now consider the i-th number if j=1 that the i-th number doesn't * x if j=0 that the i-th number *x if k=1 that there is an area *x before if k=0 that there isn't an area*x before so we can find that

      dp[i][0][0]=max(dp[i-1][0][0]+a[i]*x,max(dp[i-1][1][0]+a[i]*x,a[i]*x));
      dp[i][1][0]=max(dp[i-1][1][0]+a[i],a[i]);
      dp[i][1][1]=max(dp[i-1][0][0]+a[i],dp[i-1][1][1]+a[i]);
      
  • »
    »
    5 лет назад, # ^ |
    Rev. 2   Проголосовать: нравится +8 Проголосовать: не нравится

    My Segment Tree solution was overkill, as it was a DP problem. Because I'm jobless and narcissistic, I'm explaining my solution anyway.

    1. Given numbers $$$a[0] .... a[n-1]$$$, let us calculate $$$upto[i]$$$ and $$$from[i]$$$ which would give you the maximum sum of the subarray the ends at position $$$i$$$, and starts from position $$$i$$$ respectively.

    2. $$$upto[i] = max(0, a[i], upto[i-1] + a[i])$$$

    3. $$$from[i] = max(0, a[i], from[i+1] + a[i])$$$

    4. The first observation is that if we decide to apply the operation from $$$a[L] ... a[R]$$$, and it was optimal then $$$answer = upto[L-1] + (a[L] + ... a[R]) * x + from[R+1]$$$

    5. Let us define a function $$$ f(l, r) = upto[l] + (a[l+1] + a[l+2] + ... + a[r-1]) * x + from[r]$$$. The required answer is the maximum of $$$f(l, r)$$$ for $$$l < r$$$. If we attempt to solve this naively by precomputing $$$upto[]$$$ and $$$from[]$$$ and prefix sums, then this can be done in $$$O(n^2)$$$, which is too slow.

    6. Let us define $$$g_r(l) = upto[l] + (a[l+1] + .... a[r-1]) * x$$$. Here $$$f(l, r) = g_r(l) + from[r]$$$.

    7. Obviously $$$g_{r+1}(l) = g_r(l) + a[r] * x$$$ for $$$l != r-1.$$$

    8. If we keep a segment tree that supports range-max queries and range-sum updates to represent $$$g_r$$$ for different values of $$$r$$$. Initally all the values are 0. This represents $$$g_0$$$. For each r = 0 to $$$n-1$$$, do the following:

    • calculate the maximum in the subarray right now. One possible $$$answer = max(g_r[0...r-1]) + upto[r]$$$.
    • update the values from $$$0 ... r-1$$$ by $$$a[r] * x$$$.
    • set $$$g_r[r] = upto[r]$$$.

    If you get the boundary conditions right, then you have found an overkill $$$O(n log n)$$$ solution. See my submission 53151609 to know more.

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

How to solve 4th one?

My approach :
Let ans = kadane(original array)
If x >= 0 && all A[i]<=0 then answer is 0
If x >= 0 and all A[i] are not negative, then find subarray with max sum, multiply with x. Now ans = max(ans, kadane(modified array))
If x<0 then find subarray with most negative sum, multiply with x, Now ans = max(ans, kadane(modified array))

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

I thought $$$O(k! + 10^{6} + 3)$$$ solution for problem E. Use gaussian elimination for polynomials $$$f(x) = \sum_{i=0}^{k} a_{i} x^{i}$$$ for all $$$x$$$ in $$$[0, 11]$$$. I was stuck at D so I couldn't implement this solution in a rest of time. Any better ideas or approaches for E?

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

I'm seeking someone who debugged their problem D code after getting WA on test 10. What kind of input could be there on test 10?

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

Problem B.

Please, can anybody show me where is the mistake in my code?

And counter test if possible. https://codeforces.com/contest/1155/submission/53136294

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

    Can you explain to me your idea?

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

      Let x = (n — 11) / 2 Going from the start and marking first x eights (if possible) and first x non-eights (if possible) Then one more time going from the start and the first not marked element is the answer (if 8 then YES, otherwise NO).

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

        you have a mistake because if cnt8 == 0 and s[i] == 8 then you will try to remove it with a cnt1 value. But this is a waste since obviously player 1 does not want to remove 8 values.

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

          Thanks. I have absolutely no idea how I could forget about this. It costs me 1.5 hours of smashing the table and rating of course. Maybe today I was tired. I do not know. Thanks...

  • »
    »
    5 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится
    for (int i = 0; i < n; i++) {
                    if (s[i] == '8' && cnt8 > 0) {
                        s[i] = '?';
                        cnt8--;
                    } else if (cnt1 > 0) {
                        s[i] = '?';
                        cnt1--;
                    }
                }
    

    What if s[i] == '8' but cnt8==0? If cnt1 is still positive, you will erase an 8

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

Logic for Problem C: I found the difference between first two elements. Then found the least factor which is divisible by the difference. Then decided the answer on the basis of this factor. Code Link

Can u give a test case where it is failing.

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

53163062 could any one help me with my solution on C? i don't know why i got wrong answer in 11; i think logic is fine.... help me please.. i'm stupid...

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

Спасибо, Михаилу за раунд. Этот тот самый редкий случай когда раунд вышел неплохим.

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

I found this interesting solution, is this allowed vovuh? The code is not visible, so how does someone hack?

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

https://codeforces.com/contest/1155/submission/53152525 Problem B Why does this give runtime error ?

If I simply change the values to some letter, let's say 'a' instead of erasing a number, I stop getting runtime errors but I get TLE.

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

    you should will never stop with undefined behavior while(*****s[j]=='8'*******){ j++; } s.erase(s.begin()+j); ////////////////////////////////// while(******j < s.size()******* and s[j] == '8')++j;

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

Does anyone have test hack for D ?

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

My overkill solution 53155985 for D is using sqrt decompopsition. I divided the array into blocks and then handle two cases:

1: The endpoints of the multiplied subarray lie in different blocks

2: The endpoints of the multiplied subarray lie in the same block

Did anyone also solve it using this method?

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

I found what looks like cheating to me.

Submissions 53159161 and 53158255 which are made by different accounts are exactly the same, and submissions 53139289 and 53139670 made by the same two accounts are exactly the same except for an extra return 0; line which is commented out in one of the submissions but not the other.

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

    How do you find these submissions? Are you running a script for this?

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

      I was manually looking through submissions one by one trying to find hackable ones.

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

    what the moo Bessie why are you asking poor high schoolers to solve your relationship problems with my boy Farmer John when you can code the solutions yourself

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

I tried to solve C(alarm one). My code is as follows https://codeforces.com/contest/1155/submission/53159102 . I solved it in O(n) but still got some runtime error! PLease help

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

    Runtime Error is because you didnt use long long.

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

      You wouldn't get a runtime error for not using long long. You would get a wrong answer when int overflows. In this case the runtime error is because he is using 2 arrays of size 300001 inside main. You should declare those outside of main.

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

Have a look at this and this submission .. ment intentionally hackable and there are many more of this kind

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

I'm new to codeforces, does open hacking means there will be no points for hacking?

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

How to solve E?

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

Can anyone offer some help as to how Gaussian elimination (and/or Lagrange interpolation) generalise to when the system of equations (and/or set of points on a polynomial curve) is taken modulo a prime, as in today's problem E?

I've been trying to get my head around it but there doesn't seem to be anywhere on the internet addressing it — https://cp-algorithms.com/linear_algebra/linear-system-gauss.html for example asserts 'we can still use the described [Gaussian] algorithm' but I don't see how this follows.

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

    All we use when defining Gausssian elimination and Lagrange interpolation and when proving their correctness is that we can add/subtract/multiply numbers and divide by numbers that are not zero and that these numbers follow the standard rules (e.g. distributivity). As such, these algorithms work over any [field](https://en.wikipedia.org/wiki/Field_(mathematics)), not just over the real or rational numbers. It is a well-known fact that Z/pZ with p prime is a field.

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

      Ah okay — so when changing the cp-algorithms Gaussian elimination implementation for the modular system case, we can just adjust the division of a number with multiplication with that number's inverse (mod p)?

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

        Yes, that is correct. In fact, your code may become a bit simpler because any non-zero diagonal element will do, whereas you want to choose the largest diagonal element in the floating-point case for stability.

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

          Thanks very much — I think it's clear I need to get my head around the correctness proofs etc. better before implementing something, but once I do I'll keep that in mind :)

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

Мне казалось, что имена Петя и Вася дают людям из условия, чтоб проще определять кто каким ходит, взглянув на первую букву имени. По крайней мере до этого момента в задачах, которые я встречал, всегда было так. Не очень удобно, когда идут наперекор традициям, что произошло в задаче B.

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

    Так как n нечётно то на решение это видимо не влияет

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

Spoilers:

first guy:why my rate hasn't change

second guy replies:the system didn't start testing

first guy: but it's written final standing.

third guy: why the system didn't start testing yet !.

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

 Problem D felt

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

Please update ratings and add tutorials, can't wait.

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

During the contest, my solution for problem B passed the pretests. But, during the system testing, the judge is giving "Compilation Error" as verdict. How is that even possible? Kindly look forward in the situation.

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

My solution for problem D is taking wrong answer on test 5.But i can't understand why.Can anyone help me pls?(Sorry for my bad english)53179364

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

Thanks for the contest. I'm finally Purple Now :D

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

I'm so confused that I was told I have to be skiped due to my solution for E 53159928 is coincides with solutions 53156214

I'm sure that I just use a third party code Gaussian elimination ,the opensource code is posted in 2018/08/26.

According to Rule about third-party code is changing

Solutions and test generators can only use source code completely written by you, with the following two exceptions:

the code was written and published/distributed before the start of the round,

the code is generated using tools that were written and published/distributed before the start of the round.

Except the opensource part of my solution,the left part is just two loop and the use of function,I think most of the people who pass the problem E has the familiar writing style in this part.

So MikeMirzayanov and awoo is it my fault or careless about the use of third party code?

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

    Sorry.

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

    Hesitating will be defeated!

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

    Such a notorious coincidence that your submissions were the same on D as well. 53150449 vs 53147765

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

      Isn't it you don't noticed that my solution of D is similar to lots of people you clever boy?

      If you want to say something,just do it,don't beat around the bush : )

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

        Okay look here. You are currently complaining about getting caught while literally sharing the same code for every problem this entire contest. Just stop.

        a: 53128023 vs 53127195

        b: 53131283 vs 53129702

        c: 53137382 vs 53134674

        d and e: see above

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

          Oh Man,have you ever look for some other ABCD's solution is similar with mine which is wrote in c/c++,that's plenty of the similar code about the ABCD So that's your evidence that I'm a cheater? And how can I cheat other people 's solution? Why not @buxing201606 to join the judge? What you said above is just personal affront to me

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

            "have you ever look for some other ABCD's solution is similar with mine which is wrote in c/c++". In fact, I have. I took the first 10 or so accepted solutions for problem C written in C++11. Even if they all implement the same idea, let's take a look at how they differ from your code.

            • 53191694 didn't memorize the numbers (no arrays), wrote his own gcd function and also used abs for differences
            • 53191661 wrote his own gcd function, alternated input with gcd computation (so different flow); also, arrays are 0-indexed
            • 53191201 used stl vectors instead of arrays, treated n==1 case separately, also own custom gcd function (though here it's part of the template)
            • 53190037 wrote their own gcd function, didn't memorize arrays, also did some weird thing to consume input once the execution was finalized (though they didn't have to)
            • 53189796 alternates input with gcd computation, doesn't use 0 as neutral element for gcd (instead starts with the difference of first two elements); also, the output is all handled at the end of the program
            • 53189373 alternates input with gcd computation, uses stream IO, handles all output (and some other operations I don't get) at the end of the program
            • 53188909 custom gcd function, stream IO, stl vectors instead of arrays
            • 53188661 custom IO, alternates input with gcd computation, doesn't use 0 as neutral element for gcd
            • 53188393 stream IO, uses a separate array for memorizing adjacent differences, handles all output at the end of the program
            • 53187814 custom gcd function, stream IO, separate array for memorizing adjacent differences (sort of similar to previous submission, but different flow: alternates gcd computation with computation of differences array)
            • 53187738 custom gcd function, stream IO, alternates input with gcd computation, doesn't use 0 as neutral element of gcd
            • 53187071 custom gcd function, stream IO, uses array for memorizing differences (sorts it too for some reason), uses an unnecessary min when computing gcd, all output is handled at the end of the program

            As you can see, all of these implementations differ form yours (in more than 1 aspect), even though they implement the same idea. Subtle differences WILL naturally appear in codes written by different people, even if they express the same thing.

            In fact, the probability that two codes are EXACTLY the same (modulo headers, indentation and variable names) is extremely low, even for a simple problem. The probability that all codes are the same for ALL problems during the contest is so small it's not even worth considering.

            If you want to "steal your own hat" and cheat, that's fine by me. But the fact that you then come to the blog and complain about being caught, acting innocent, is quite frankly an insult to the CF community.

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

              You can read what I said just before,I just learn some skill from the blog I said below,I don't think the header can be seemed as evidence,maybe,I say maybe,buxing201606 is also a learner from the blog I said below. That's all that I know

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

          What you give us seems the true,but even if everyone don't trust me,I know I'm innocent.

          What you said about ABC I think it's not strong enough to prove your opinion.

          But,actually myself also think the solution and the writing style about the problem D is so similar. I don't know why buxing201606 has the same simplify operation about getmax function,what can I say is just where I learn this function.

          Once I search some solution in the web,I found this blog blog of notnight,and the simplify operatin is just modify from it.

          I'm a retired ACMer(retired just last year),I bet my honor as a programing competition participant to say,what I said above is all that what I know about the whole case.

          That's my last reply to you,no offend,best wishes in your programing competition days.

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

      I really didn't know him before, and I didn't share my code with others during the contest. The template for Gaussian elimination is copied and pasted from someone else's blog. I searched for Gaussian elimination on the search engine. The first blog is this.

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

        Did you also copy-paste from a blog the solutions to the other 4 problems which you guys solved with the exact same code?

        Seriously, I don't know what you two are debating here. It's obvious that (at least) one of you cheated. It's like a kid telling you they didn't eat the cookies, with crumbles around their lips.

        I don't even know who you're tying to sell the story to. Mike won't take any action (as it's been shown before), I myself couldn't care less, and neither does anybody else: you are the ones who started the topic in the first place. Just let it go and save yourselves the hassle.

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

    It is not a question of using third-party code. I do not have time to debate on this issue, I once again carefully looked at and studied all the arguments. My decision remains unchanged. A large number of suspicious coincidences do not leave it to be considered an accident:

    • incredible coincidences in solutions on other problems,
    • similar code in these programs that is not part of the third-party code.

    Probably, there was an unintentional leak, which is also violation. I suggest you both to change passwords and use only https in the future. Good luck.

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

Editorial link????

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

I wonder why I got AC from this random solution that I made for problem B. Can anyone explain it to me?

I define F8[i] as the number of digits 8 from the 1st to the ith character.

https://codeforces.com/contest/1155/submission/53148643

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

Can anyone tell me how to use dp in D question....? i am new to competative.. and how i recgonise that dp is use or not... is there any trick or it comes with practice... any related question to that so that i can practice.

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

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

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

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

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

oh my, halyavin 292 successful hacking attempts? What?