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

Привет, Codeforces!

В May/21/2018 17:45 (Moscow time) состоится Educational Codeforces Round 44.

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

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

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

Задачи вместе со мной готовили Адилбек adedalic Далабаев и Владимир vovuh Петров.

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

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

Место Участник Задач решено Штраф
1 Benq 6 143
2 crhkr 6 202
3 mjhun 6 210
4 nhho 6 210
5 krijgertje 6 223

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

Место Участник Число взломов
1 step_by_step 248:-25
2 greencis 31:-6
3 zero-light-some 15
4 Necrozma 12
5 Codefocres 11:-1
Было сделано 703 успешных и 490 неудачных взломов.

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

Задача Участник Штраф
A dotorya 0:01
B dotorya 0:03
C dotorya 0:10
D Benq 0:21
E ThePilgrim 0:07
F Deemo 0:49
G Marco_L_T 0:44

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

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

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

Finally, educational round, I miss you!

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

I love this round. As, educational, it teach me a lot.

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

What happened to BledDest? I have not see him in any educational contest for a while.

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

Участники выше рейтингом 2100 указываются как официальные участники.Это так должно быть ?

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

What is an educational round? How is it different from a normal one?

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

    It is meant for we to try multiple types of problems, even if they might not be very original. Each problem has not a specific score, but rather is just the solving time that makes your score. This means that, for example, solving A+B+D and solving A+B+C within the same exact time will give the same score, even if D might be more difficult than C. Finally, hacking is not enabled during the contest, but a long (12-24 hours) hacking phase takes place after the contest. After that, system tests are run, as for normal contests.

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

Please, choose more comfortable As, Bs and Cs in future rounds, so that they're not just silly implementation problems :)

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

The third lucky number,

It's palindrome number,

Double the sum of it's digits equal to any digit of it square,

The number which product of it's digits equal to any digit of it square.

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

What about div.3 ?

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

Are the problems easy?I'm new in here.

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

Educational round always enjoyable to me. I love to participate in the educational round.

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

Thanks all the authors to put the great effort and valuable time for preparing this educational round, these rounds are very helpful for learning.

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

Can't you delay this contest by two hours awoo

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

Are tasks sorted in difficulty order?

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

Wish everyone high ratings :D

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

First educational round rated for purple :)

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

aaand 10 mins delay :/

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

Rly?

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

Вероятность того что будет задача на теорию чисел?)

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

That moment when the round gets delayed and you suddenly have 10 minutes but you don't know what to do with them.

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

What is test case 7 in C?

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

Approach for C? I had thought to take the lowest number as one barrel with the least vol and then take another barrel such that a[i]-a[0]<=l and ai is maximum. Now if we have n-2 numbers between these such that a[0]<=a[j]<=x then we have an answer otherwise 0. Is this approach correct?

PS I failed on TC-#7

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

    Well, you can't do that. Because solution isn't optimal. What you need to do (I did it in this way, maybe there are easier ways) is find maximum number p such that a[p]-a[0]<=l. Then, from p to what number left, "erase" numbers bigger than a[p] (make them join group where a[p] is last element) so res+=a[p] for every decreasing p that has numbers bigger and not used. (sorry for bad english..) When you finish with the big numbers. Go from i=0 to remaining numbers that you didn't used. And that's it. I hop you at least understand something. Check my submission for more details.

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

    maybe the number of a【i】will exceed n-1

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

Why is hashing needed in F?

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

Hello, can somebody explain the solution for F (Isomorphic Strings)? My guess is some form of hashing, but I could not come up with a way.

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

E was such a nice problem.., although was unable to do it during contest!!

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

Problem D. — I thought h1 was a typo in h_1 ≤ H: no sand should go over the fence; because of the no one clause, but as reading whole statement and asking to judge, turns out it wasn't ;'(

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

for D, first condition that watched me h[i] <= H first time, after get WA on 7, h[1] <= H

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

ideas:

E: Sort, now the boxes can contain consecutive elements so we can dp

F: Let's calculate the hash for each character using a segment tree.

G: Sum the ranks of all possible teams (i,j,k), then for every edge (u,v) subtract the rank of (u,v,k) for every k. Finally add the rank of (u,v,w) for every triangle (u,v,w) in the graph

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

is it rated?

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

E solution... wrong.... so sad.... :( Is it rated...?

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

Can someone explain their solution for E? I was thinking about something involving cliques but couldn't figure it out.

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

    first sort all numbers, now you just need to group consecutive elements, we can use dp to solve this problem. Let dp[i] indicate whether the first i elements can be successfully grouped, dp[i] is transferred by dp[l] | dp[l + 1] | ... | dp[r — 1] | dp[r]. l, r is the interval endpoint that makes dp[i] exactly satisfy condition, As i increases, l increase, r increase, so you can use deque to maintain.

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

Is finding all triangles in a graph something well known to the community? I managed to find this which works in O(M3 / 2) but this is my first encounter of this algorithm.

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

How to solve C ? I got WA on test 8 :(

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

    Sort. The first element (in the sorted array) will be taken for sure so, find the maximum array index which is less than or equal to (first element + l), if there are less than n elements then print 0 and exit. Else, starting from this index move backward and pick greedily such that there are enough of elements ahead of it. Hopefully, it is correct.

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

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

OMG, in problem D i thought i CAN NOT make pillar higher then H...

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

Why everyone is doing hash for F? There is a 24-hours hacking phase await... (don't know if random power base can save us from this)

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

    Is it possible to hash large subsets with one modulo? I thought about this during the contest but decided that collision probability would get too high...

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

    Can you explain your solution ?

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

      It works like this:

      First we replace each letter in S with the distance to the nearest same letter on the right, or ∞ if there's no such letter. E.g. "abacaba" becomes [2, 4, 2, ∞, 2, ∞, ∞]. This takes O(n) time. Now instead of a sequence of letters, we have ≤26 interleaved linked lists — one for each letter type in S.

      If substrings X and Y are isomorphic, then all elements of linked lists that form X must be identical to those which form Y, except the last elements, since they point outside our region of interest.

      Therefore, X and Y are non-isomorphic, iff there is an index i, s.t. X[i] != Y[i] && (X[i]+i < len(X) || Y[i]+i < len(Y)). To find i, we quickly (using a lcp array) iterate over all j, X[j] != Y[j] and check X[j]+j < len(X) || Y[j]+j < len(Y). We will do at most 26 iterations, because X[j]+j >= len(X) means that j was the last occurrence of the letter at j.

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

[PROBLEM C] Could you tell me where i wrong? My solution got wrong answer on pretest 6 https://ideone.com/Xfb3Ek

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

Problem E was a subtask of this problem : Here

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

38507649
I made a stupid mistake in 985F - Isomorphic Strings.
Come and hack me >///<
But I still love ♥ 127 ♥

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

Can you believe it, I assumed that the positions in A were sorted. Couldn't figure out this till the end and got WA. Not complaining, but the examples could have been 'unsorted'? :(

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

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

How to solve E? (My greedy solution got hacked)

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

Seems that uwi is on a killing spree for Problem F...

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

    I tried to hack solutions of rolling hash of 2 const modulo after waking up, but the contest had finished.

    To hack rolling hash by 1 const modulo is very easy by birthday attack.

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

how to solve D?

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

1000000000000000000 1 For this case how the answer be 1999999999

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

Why are "acc" and "cac" not isomorphic for problem F?

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

Anybody idea for E.

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

D was the worst possible type of tasks for me. It's a pity it appeared in the contest, even more that it was placed before E, which was quite easy for me.

Also I'm not sure that the round should be rated as I started coding D because at the time of making a decision, E was not solved by anybody (so E appeared to be harder than D), due to the error. Issues in E had impact on many participants. I believe I got 3 problems instead of 4 due to that.

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

    Wait, this happened about half an hour into the contest. Wasn't that your fault to spend the rest of the time on the problem of your weaker topic instead of reading the other ones? I'm sure that the ranklist after half an hour tells nearly nothing about the difficulties of the problems.

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

      I checked more precisely. At the time I was looking at the next task (after solving C), there should have been 23 E solutions accepted already, this was the last one:

      http://mirror.codeforces.com/contest/985/submission/38494892

      At the same time there was 0 accepted solutions to E and there were 11 accepted solutions to D, the last one: http://mirror.codeforces.com/contest/985/submission/38495105

      I have no reason to lie, as I said I expect a positive rating change. If I had seen these numbers when I was making a decision I would have started with E.

      I just have a feeling that the issue with E is sufficient to make this contest unrated. I was impacted indirectly but many people were impacted directly.

      Besides — there was incorrect author's solution, this fact should make the whole round unrated, given ACM rules. I object to policy of making rounds rated just to please the maximum number of people. Rounds should be unrated unless they ran perfectly in 100%.

      What do you think MikeMirzayanov?

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

      UPD: My fault... See comments below.

      Well, it is a good round ... but problem D. (No offensive).

      Even though problem D itself is a good one, but it is not very friendly to the CPPers.

      We need to handle two long long multiplication carefully. ( Aha! I know it! I avoid this! )

      And then math functions bring floating errors! ( WHAT? TIM_20180519215120)

      Should "handling floating errors" really be the part of the contest?

      My key point is : D is a good problem, but it shouldn't make certain languages better than others.

      (Making D's limit into 109 would be a better choice, I don't know any brute force that can pass 109 but not 1018).

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

      To make it more clear — maybe it wasn't understood for the first time.

      If there were no issues, that would have been my fault 100%. However in this particular case, my decision was biased by the bug in writer's solution.

      I also think that it might be the case with more people as the difference in accepted solutions between D and E is very small, while it should be something like 250 for D and 450 for E, but I guess that many more competitors jumped to D as they saw that nobody was able to solve E for almost an hour.

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

    The worst excuse ever.

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

      It is not an excuse as I will probably get positive rating change after this contest (at least this was my knowledge when writing this post)... And I'd rather give it up for unrated round as I feel that this contest was interrupted by the bug.

      It just demonstrates the subtle impact of the issue. I based my decision on the number of problems solved and I got stuck on D until the end of the contest and I have a reason to believe it would not have been the case, but for the mistake.

      As regards previous comment — it is not true. After 40 minutes I should have seen comparable number of solutions to both problems. If I see around 30 solutions on D and 0 on E, it is a clear indicator for me that D should be easier than E (not everyone should follow this logic).

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

Why I got RUNTIME_ERROR in pretest 7? 38505110

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

    The error is caused in this line:

    while(cnt && abs( *(s.rbegin()) - *L ) > l )

    You are trying to access to the value pointed by L, but a few lines before, you erased that value from the set. I saved *L in a variable before deleting it from the set, and the Runtime Error was gone, but now it gives Wrong Answer. I'm not really sure what's the idea behind your code, so I can't help you with that. I hope this comment helps you solving the problem :)

    PD: there is another error in that line: you forgot to check that the multiset is not empty before trying to erase an element from it. That may cause Runtime Error too. Bye!

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

can anyone help with some good test example for problem E ? I have made the code but unable to understand where it could go wrong. #noob

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

can anyone help with a good test case for problem E ? cannot Figure out where it could go wrong. #noob

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

Hi, I just wanted to mention that it seems that users with rating above 2100 are registered as official contestants... or at least they don't disappear when I unset the "show unofficial" checkbox.

Hope that doesn't causes any problem.

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

In contests page, the hacking phase for this round seems to be for 12 hours rather than a day.

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

Problem D is similar to SRM 721 Div1 Easy.

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

For problem F,if the size of alphabet is up to 10^5 or larger and other constraints remain the same,is there any approach to solve it?

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

Can anyone tell me Problem F why my solution get WA on test 16's 9259th query? I have been debugging for more than five hours. qaq. this is my submission code: 38512729

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

As a novice, I have a question for everyone. Why did I submit the same code twice, but one got AC, another got WA. 38509969 during the game. 38524984 after the game

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

Problem C:Why I got TLE Verdict?38494646

I didn't use while() so there are some troubles on sort?

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

System test has finished,so is it rated?

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

when will the editorials be updated?

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

The rating were changed so it's rated

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

does hacking a solution not effect our rating

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

Is there any solution for F except O(N * 26)?

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

What is GNU C++17 Diagnostics (DrMemory) ?? Can someone tell me ??

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

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

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

Thanks for div2 only contests !11!1

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

__i use ideone to run the code but the solution is copied and i get unrate. Does my computer have malicious code? Explain me, please.

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

Where is the editorial ?

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

Где разбор?!

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

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

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

In Question C,I had got time limit exceed in test case 19 in java while with same algorithm (same code) in C++ is able to pass all test cases.

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

In problem D,

when I use round() function to round the division operation to nearst integer value it causes me WA in testcase 18 though the round function isn't making any difference!

accpeted sol: http://mirror.codeforces.com/contest/985/submission/38600567

wa sol : http://mirror.codeforces.com/contest/985/submission/38600584

round() is not making difference: http://mirror.codeforces.com/contest/985/submission/38600633

and all of this solutions provide correct output -1 in my local machine!

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

Thank you.