By awoo, history, 8 years ago, translation, In English

Hello Codeforces!

On April 15, 17:35 MSK will be held Educational Codeforces Round 19.

This Educational Round is held as Harbour.Space university initiative. It's the second round supported by Harbour.Space. You can read the details about the cooperation between Harbour.Space and Codeforces in the blog post.

Some educational programs in Harbour.Space are interesting for most Codeforces users. One of them is Data Science Program. Here is few words from Sergey Nikolenko, Harbour.Space lecturer and Senior Researcher, Steklov Institute of Mathematics at St. Petersburg Russia.

The round will be unrated for all users and it will be held with extented ACM ICPC rules. After that you will have one day to hack any solution you want. You will have access to copy any solution and test it locally.

You will be given 6 problems and 2 hours to solve them. We tried to prepare such problems that both novices and experienced coders will find something interesting in this contest.

The round was prepared by Ivan BledDest Androsov, Mikhail MikeMirzayanov Mirzayanov and me.

Wish you enjoy the contest! Good luck!

UPD: Editorial

Congratulations to the winners:

Rank Competitor Problems Solved Penalty
1 Reyna 6 214
2 tqyaaaaaaaang 6 230
3 nuip 6 303
4 W4yneb0t 6 341
5 lexuanan 6 457

Congratulations to the best hackers:

Rank Competitor Hack Count
1 step_by_step 40:-7
2 halyavin 44:-17
3 STommydx 20:-5
4 yp155136 18:-2
5 FlierKing 24:-15

234 successful hacks and 308 unsuccessful hacks were made in total!

And finally people who were the first to solve each problem:

Problem Competitor Penalty
A Lewin 0:01
B 300iq 0:04
C fanache99 0:09
D Reyna 0:21
E Vladik 0:08
F skywalkert 0:40

  • Vote: I like it
  • +134
  • Vote: I do not like it

| Write comment?
»
8 years ago, # |
Rev. 4   Vote: I like it -29 Vote: I do not like it

It overlaps with GoogleCodeJam round 1A !

UPD: It doesn't overlap .. thanks for yinanzhu and KieranHorgan

»
8 years ago, # |
  Vote: I like it -42 Vote: I do not like it

is it rated?

»
8 years ago, # |
  Vote: I like it +30 Vote: I do not like it

Why not all the contests have clear problem statements like this one. Thank you for this interesting contest.

»
8 years ago, # |
  Vote: I like it +16 Vote: I do not like it

How to solve F?

  • »
    »
    8 years ago, # ^ |
      Vote: I like it +31 Vote: I do not like it

    I don't know the time complex of the std. But the time limit makes me think that the std have the time complex of O(n2).

    My solution's time complex is , and it costs 858ms.

    First it's easy to come up with the DP of O(n3). Then let's look at the programme carefully, and we can find out that it's very similar to Knapsack problem. And this classic problem have a classic way(divide each original item into items) to optimize it to

    We can use the same way to opimize the original problem. Then we solve the origine problem in

»
8 years ago, # |
  Vote: I like it +8 Vote: I do not like it

very interesting problem set. I hope to see more problem set like this! :D

»
8 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Can anyone tell me why im getting TLE on E. My idea is precompute for every k below 1000 in O(N) each and just simulate all k bigger than 1000 (worst case scenario is 100 operations if im correct) 26393091

»
8 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Did someone pass TL42 with mincost maxflow on F?

»
8 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Never thought I could make more points than some reds or oranges. Strange contest =)

»
8 years ago, # |
  Vote: I like it 0 Vote: I do not like it

How to solve C ????

  • »
    »
    8 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    You can solve it greedily.

    for (char c = 'a'; c <= 'z'; c++)
    {
      // Try to place current character 'c' in the target string.
    }
    
»
8 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Can someone explain to me why in the second test for E the 8th number is 2?

10
3 5 4 3 7 10 6 7 2 3
10
4 5
2 10
4 6
9 9
9 2
5 1
6 4
1 1 <-
5 6
6 4

p = 1, a[1] = 3, k = 1, n = 10;
Initially p = 1. After first operation p = 1 + 3 + 1 = 5. After second operation p = 5 + 3 + 1 = 9 < 10. What am I missing?

  • »
    »
    8 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    In the first operation p = 1 p = p + a[p] + k p = 1 + 3 + 1 p = 5 In the second operation p = 5 p = 5 + 7 + 1 p = 13 p > 10

    • »
      »
      »
      8 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Ah, I see. Thanks! I completely missed the fact that when p changes the array element chages as well.

»
8 years ago, # |
  Vote: I like it +40 Vote: I do not like it

Please discuss the approach for problem F.

  • »
    »
    8 years ago, # ^ |
      Vote: I like it +16 Vote: I do not like it

    You can solve it using dynamic programming. Let DP[j][i] denote the minimum cost to assign the first i mice to the first j holes. For each state, iterate over the leftmost mouse you will assign the jth hole to. This takes O(m*n*n) time.

    But notice that for a fixed j, the optimal left-point is non-decreasing for non-decreasing i, i.e. optima[j][i] <= optima[j][i+1]. So you can speed up the DP using divide-and-conquer optimisation.

    Code

    • »
      »
      »
      8 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      How do you deal with hole capacities and the fact that contiguous mice are not necessary assigned to the same hole?

      • »
        »
        »
        »
        8 years ago, # ^ |
          Vote: I like it +4 Vote: I do not like it

        The group of mice assigned to some hole is always contiguous, i.e. there will never exist a situation that a,b,c are three consecutive mice (in increasing order of coordinate) but a and c are assigned to hole-1 but b is assigned to hole-2.
        And what do you mean by how I deal with hole capacities? If I have to assign some suffix of the first x mice to hole j, then I can assign atmost the last capacity[j] mice to hole j.

        • »
          »
          »
          »
          »
          8 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          Just a moment after I posted, I realized sorting was enough to assign contiguous mice to a hole.

          As for the hole capacities, yep, I meant that (and I missed it's as simple as that!)

          Thank you :)

»
8 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Can someone please help me in finding mistake in my Solution for problem C.

  • »
    »
    8 years ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    Your code fails for this testcase : abcbabbcc

    Your code outputs aabbccbcb whereas the correct answer is aabbbcbcc

»
8 years ago, # |
Rev. 4   Vote: I like it +3 Vote: I do not like it

Can someone tell me where I am wrong in D?

I made a fucntion checkValid which takes node,l,r as arguments. And marks true if value[node] lies between l and r both inclusive. Then, I call checkValid with left[node], and with the intersection of (-inf,value[node]-1) and (l,r). The same process is repeated symmetrically for right node.

I am getting WA at Test Case 20. And my answer differs by 1 from expected answer.

Submission Link: 26396243

  • »
    »
    8 years ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    There were two mistakes.

    One was a syntax error at line 92. Second mistake was I was remembering the nodes which are visited instead of values.

    AC solution: 26398128

»
8 years ago, # |
  Vote: I like it 0 Vote: I do not like it

No successful submissions on E in Python 2 or Python 3. I tried to rewrite one Java solution to Python, it TLE-ed on test 7. Isn't the time limit of problem E too tight for Python?

»
8 years ago, # |
  Vote: I like it +6 Vote: I do not like it

It's my first time to try hacking here on CF. Not sure how it works. It seems to be just stuck loading forever. Is this supposed to happen?

  • »
    »
    8 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Reload

    • »
      »
      »
      8 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I tried reloading many times, and also clearing my browser cache/cookies before trying again. This happens after I submit the input for hacking by the way.

»
8 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Can anybody tell why my code is failing in one of the tests ?? https://pastebin.com/GC45xUAa

  • »
    »
    8 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    26389948

    ^This implementation is similar to yours. You can refer to this one.

    • »
      »
      »
      8 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Its quite confusing . He has considered even more cases . Can you read my code once and tell me , which case I might be missing ??

»
8 years ago, # |
  Vote: I like it +17 Vote: I do not like it

That's how you try to cheat even in an unrated round!!

ScreenShot

»
8 years ago, # |
Rev. 2   Vote: I like it +6 Vote: I do not like it

I noticed that if I submit a solution after a previous solution got hacked, then my new solution runs only the original system tests, and not the hack(s) that caught my previous solution(s). That's too bad, because that way I can be "Accepted" again without fixing my problem (in fact, I have no idea whether I fixed my problem unless the hacker is kind enough to keep trying the hack on my new solution).

UPDATE: Appears to be fixed now.

»
8 years ago, # |
  Vote: I like it 0 Vote: I do not like it

http://codeforces.net/contest/797/submission/26402069 why this submission always wrong at 25th test case???who can help me ??

»
8 years ago, # |
  Vote: I like it +1 Vote: I do not like it

I'm unable to submit a solution for the contest. It shows that System Testing is going on, while it was over hours ago.

On clicking the submit button, it shows the message "Practice is allowed only for finished and unfrozen contests".

»
8 years ago, # |
  Vote: I like it +3 Vote: I do not like it

Is it normal that problems B and C now have duplicate tests? For example, there is the test #48 "1 // 1" that repeats further as #50, 51, and 54. Problem C also has such tests, e. g. "a" by #40, 41, 42, 45, 47, and 51.