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

Привет, Codeforces!

В 26.01.2019 18:35 (Московское время) состоится Educational Codeforces Round 59 (рейтинговый для Див. 2).

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

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

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

Задачи вместе со мной придумывали и готовили Роман Roms Глазов, Адилбек adedalic Далабаев, Владимир vovuh Петров и Иван BledDest Андросов.

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

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

Hello Codeforces!

A quick reminder to check out the Hello Muscat Programming Bootcamp!

Every day, both the Hello Programming Bootcamp and the Moscow ICPC Workshop will be competing simultaneously, 4,000 kilometers from each other — our camp will take place in Oman, from March 9th to March 15th, 2019 — registration is still open for this unique opportunity, so be sure to give it a look, we would love to see you there with us!

REGISTER FOR THE BOOTCAMP

And, don’t forget that Harbour.Space University’s opportunity for a fully funded Master’s in Robotics programme scholarship is still open! Head over to their website to see the details, and apply before the registration date closes.

APPLY HERE

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

Место Участник Задач решено Штраф
1 vintage_Vlad_Makeev 7 198
2 Radewoosh 7 358
3 Rzepa 7 396
4 eddy1021 6 170
5 spacewanker 6 175

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

Место Участник Число взломов
1 _bacali 39:-44
2 Kiri8128 8
3 tymo 5:-1
4 Osamaa 4
5 sevlll777 5:-4
Было сделано 121 успешных и 527 неудачных взломов.

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

Задача Участник Штраф
A vintage_Vlad_Makeev 0:01
B neal 0:02
C neal 0:05
D vintage_Vlad_Makeev 0:10
E Fake.Puppet 0:10
F vintage_Vlad_Makeev 0:44
G Kalam 0:17

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

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

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

Clashes with Topcoder SRM. Please prepone it by 30 minutes.

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

Null

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

Clashes with indian entertainments

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

Clashes with Educational 59

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

中国玩家修仙场:)

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

Clashes with CodeChef lunchtime. Please reschedule.

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

Happy Republic Day Indian Coders!

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

Happy Republic Day Indian Coders!

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

Please make contests at more diverse time frames -- times like 18:35 MSK are really unfriendly for students living around UTC +8.

»
8 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится
Picture
Hope every one become candidate master one day.
»
8 лет назад, скрыть # |
 
Проголосовать: нравится -10 Проголосовать: не нравится

Hope that will be a lot of hack today xD

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

Nice picture though~ :D Is that the campus?

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

Give me a purple name plz...

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

Want to Be a Candidate Master... So everyone Good Luck && Higher rating... RP++

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

Clashes with clans

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

oh my the name hints it will have pointless math again. god, can't you keep these two things sepparate? is it so hard to understand that math has nothing to do with programming? it doesn't help you get better, it's just useless.
only people who want to feel better for themselves thinking they've actually accomplished something like math in programming.
so with this said let's hope for a math-free problem set.
if it doesn't have any math i will surely get out of expert. can't wait.

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

CodeForces OR CodeChef???

Both.

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

Fuck problem statements. I'm done.

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

For the question D, if i=1 and x=4 then [i/x] gives 0. This index does not belong to the matrix B What is to be done then ?

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

nice problems ^^ , how to solve E ?

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

      What's the DP state though?

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

      What is the solution for this one? The constraints here suggest that n3 is possible.

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

        For the UVa problem in the link: Let's calculate dp[l][r][len] — the most points we can gain if we do operations on s[l] to s[r] with the same len characters as s[r] attached at the back of the string. Let p be the leftmost index satisfing s[p] = s[p + 1] = ... = s[r] and q be some indicies satisfing s[q] = s[r] and s[q] ≠ s[q + 1].

        Then we can list the dp equations:

        • dp[l][r][len] = dp[l][p - 1][0] + (r - p + 1 + len)2 — if we clean all blocks from p to r ;

        • dp[l][r][len] = dp[q + 1][p - 1][0] + dp[l][q][r - p + len + 1] — if we decide to clean blocks from q + 1 to p - 1 first and the others at last.

        For today's E problem just substitute (r - p + 1 + len)2 with the most points we can gain from the string with same characters of length r - p + 1 + len. This can be done by another simple dp.

        I know the constraints suggest a O(n3) solution, but maybe many states cannot be approached? I desire the proof too ><

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

contest was so easy :D

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

How to solve D ?

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

How to solve D?

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

what was the state for the DP in problem E?

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

Is D solved in O(no.of divisors*n*(n/4))

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

To me, G seemed like a divide-and-conquer after assigning profit to each element as a-c[i]. However, I got WA on test case 7. E seemed like some kind of dp-transitions — can someone provide a hint?

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

Deleted

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

I think it's a very bad contests experience. The description is long and difficult to understand. Boring problems and difficulties of code. Some data area is not reasonable enough.

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

Did anyone solve D using Python? Pretty sure I had the right idea but I got TLE on test 4 and I'm wondering if it is because of python's I/O slowness

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

    The trick is to use PyPy and read the input with sys.stdin.read(), this will read the entire input as a string. From my testing all other ways of reading input is significantly slower.

    Here is my solution running in 1123 ms. The main thing slowing the code down is that I'm calling a function to calculate gcd. By inlining the gcd call my solution runs in 826 ms.

    EDIT: If I additionally add a check for if the gcd hits 1, and then print 1 and exit, it runs in 390 ms.

    EDIT2: Played around with it a bit more, was able to get it down to 343 ms by pretty much removing the gcd calls.

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

      @pajenegod you are the saviour of all (slow) Python user! I salute you

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

      Thanks a lot man, will try asap :)

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

       You're the boss! (with nearly the same code as in my last python3 submission of the contest)

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

        I looked at the input reading in your code. You are currently using sys.stdin.readlines(). I've been a much bigger fan of sys.stdin.read().splitlines(). It might be quicker, but more importantly removes all '\n'. So I pretty much never use sys.stdin.readlines().

        Switching to sys.stdin.read().splitlines() makes one of your solutions go from 1699 ms to 1434 ms. Then I tried to switch from PyPy3 to PyPy2. It went from 1434 ms to 1075 ms. So there's still a lot of things you can do to speed up your solution without modifying anything in the algorithmic part. Don't know how used you are to python 2 but it is usually noticeable faster than python 3.

        Python2 is pretty similar to python3 code wise with some exceptions. A small tip is to start out your python 2 code with

        from __future__ import print_function
        range = xrange
        input = raw_input
        

        and most things will be like how it is in python3.

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

          At my job we use Python2 but I've personally taken the habit to use Python3 because of the fact python2 won't be maintained anymore in 2020. So yeah I know the basic differences between the two languages but I didn't know python2 was that much faster under these circumstances. Also thanks a lot for the advice man! I'll use these tips from now on on codeforces :)

          EDIT: I was also using python3 to be able to use math.gcd in this case, but I did a bit of google search and found out gcd was in the fractions module of python2. Then I read your submission based on my code and I saw you used xrange, I know the trick but did not even think about it... So you're right, there's definitely more I can do to grind some more precious milliseconds!

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

Проклятие, не успел отправить решение на D. Медленный codeforces!!!

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

In D, I got WA on test 4, my idea is in each column and each row, I find optimal result (array ln[5204] and ld[5204]). after that, i general all to get answer of this problem, here is my code https://codeforces.me/contest/1107/submission/49020250 sbd help me,pls

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

Deleted

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

D was a nice problem.

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

Problem B marks the saddest Google search I have ever done.

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

how to solve G with binary search?

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

    You can see that each problem worths a — c.

    Let's fix gap value. That is, for each i from 1 to n — 1, binary search to find l and r satisfying l <= i <= r, and all x and y satisfying l <= x <= i <= y <= r the subsegment from x to y have the gap value equal to (di — di+1)^2. Now the only thing you have to do is find the maximum subsegment containing i in l...r. It's can be done with a segment tree storing maximum prefix and maximum suffix (very similar technique to GSS1 spoj)

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

Can anyone please tell me what is wrong with this solution for problem D.

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

this is my code. i don't understand output is why like that https://codeforces.me/contest/1107/submission/49007458

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

Can anyone solve Problem E Vasya and Binary String explain his/her approach ?

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

whats the ans for C for this test case? 6 3 14 18 9 19 2 15 cccccc

ans how ?

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

i assumed for problem C, that if i skip some button, the "consecutive count" for current character will reset.. checking test 5 and re-read problem statement, they add this

Note that if you skip the hit then the counter of consecutive presses the button won't reset.

but its ok i just solved the different problem with dp, i think :D

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

My initial submissions on problem C were giving wrong answer on sample test 1, eventhough on local, hackerrank and hackerearth compilers I was getting answer as 54 for that. Eventhough that solution was wrong but can someone explain why this happened? https://codeforces.me/contest/1107/submission/49004601

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

Can anyone explain why this code(in Problem C) is accepted without runtime error?49024911

The core section is:

string in;
cin >> in;
int len = in.length();
if(in[len-1] != in[len])
»
8 лет назад, скрыть # |
 
Проголосовать: нравится +32 Проголосовать: не нравится

How to solve E problems pls?

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

49025933 49025845 49026055 49026124

If you look at this submissions you can see there

if (n == 38)
{
    if (arr[23] == 53)
        return 0;
}

this submissions were hacked, and I think this should be considered as cheating.

UPD: Now all of his submissions are hacked (also the submissions for problems A and B)

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

It was a great contest,so what about D statement, I didnot understand it, help me pls

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

I didn't receive an Email to remind me of this round this time, weird

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

Seems like most people who solved problem E 1107E - Vasya and Binary String did it in . Does anyone know if a faster algorithm is possible?

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

Why can't I see my rating change?

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

Can anyone please explain the logic to solve E?

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

anyone knows why this outputs 1 in testcase 4 in problem D

https://codeforces.me/contest/1107/submission/49044759

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

Is system Testing done?? If not why is taking so much time? If yes why is there no rating change still?

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

Ideally, How long does it take for the ratings to update in contests like these ?

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

The predictor does not work well with me

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

Как-то не по христиански рейтинг обновился

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

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

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

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

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

I still can't see the difference between the normal round and the educational round... My guess is the difference in problem style. Am I right?

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

It is really not a good time for programmers in China, you have to drink a lot of coffee to keep yourself from sleeping:(

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

In question 'D' I am getting "Denial of judgement" "crashed" at test case 59. can anyone explain why does this happen .

Here is my solution-https://codeforces.me/contest/1107/submission/49348206