chrome's blog

By chrome, history, 9 years ago, translation, In English

Hi!

Tomorrow at 14:00 MSK will be held TCO16 Round 2A.

You can read about TCO16 here.

Also this round has limited number of competitors only 2500. And max number of advancers to the next stage is 40.

Let's discuss problems after contest.

GL && HF!!!

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

| Write comment?
»
9 years ago, # |
  Vote: I like it +22 Vote: I do not like it

Spent >10 minutes starting my computer and opening arena while found out the registration period is just over. Much frustrated orz

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

    That's why you should not use windows

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

    Honestly, I would be happier had the same happened to me :P

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

Huh, those were not easy tasks :P. 500 is very nice, so sad I was not able to come up with final piece during contest. Btw, isn't 1000 just easy LP? Can LP solution be not integral?

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

    They can.

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

      Great, so this is not another stupid LP problem, that's consoling :D.

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

        Actually algorithm of integer LP is same, just substantially harder to implement :)

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

          And definitely slower, so there is little chance it can get AC :P

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

    :) Does anybody know the solution of 1000?

    • »
      »
      »
      9 years ago, # ^ |
      Rev. 29   Vote: I like it +45 Vote: I do not like it

      1000 can be solved with this very simple algorithm based on network flow.

      Let numi be the number of opens(left parentheses) lying on the path from node i to root. depi be the number of edges of the path from node i to root. Then bali = 2numi - depi is the balance i.e. the number of opens substract the number of closes(right parentheses).

      So for a restriction of path , we have:

      balu = balv

      balw - balu ≥ 0, for any node w that lies on the path from u to v.

      Why? Because if is open, then is close. So we needn't care about the LCA.

      Besides, obviously depu + depv must be even.

      Thus, we've got two kinds of restrictions:

      OK, now let's build a graph. We know the maximal flow is equal to the minimal cut, so we'll just talk about the cut. For any node in the tree, we make n new vertices, and connect the source to the first vertex, and connect the last one to the sink with capacity , and connect adjacent vertices with capacity 0(actually we don't connect them, it's just for better-understanding), then, we have to cut one edge, if we cut the edge connecting the k-th vertex and the (k + 1)-th vertex, then we consider that num of the tree node is k.

      So for each edge connecting one node and its father. num of the node mustn't be smaller than its father's and mustn't be bigger than its father's by more than 1. If costopen is smaller, then we add the cost of open to the answer, and if the node's num is equal to its father we have to pay costclose - costopen, otherwise we'll do the similar thing.

      So how to deal with those restrictions? For example, if numu ≤ numv - Δ, for all k, if k - Δ ≥ 0 then add an edge from the (k + 1)-th node of v to the (k - Δ + 1)-th node of u, or if k - Δ < 0, then numv ≠ Δ, we can simply add an edge from the k-th node of v to the (k + 1)-th node of v. All these edge have a capacity of .

      Finally, add the minimal cut of this graph, which equals the maximal flow, to the answer.

      • »
        »
        »
        »
        9 years ago, # ^ |
        Rev. 2   Vote: I like it +5 Vote: I do not like it

        If you can't see the formulas, this is the text:

        Why? Because if is open, then y \rightarrow x is close. So we needn't care about the LCA.

        Besides, obviously depu + depv must be even.

        Thus, we've got two kinds of restrictions:

        (num_v — num_u) \ge ceil(\frac{dep_u — dep_v}{2})

        (num_v — num_u) = \frac{dep_u — dep_v}{2}

        I can't get why Codeforces can't demostrate it properly :(

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

What was the idea behind Problem 300? I was able to code a solution with runtime O(A+B+C), but it was too slow.

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

    First idea that you want to count number of non triangles, instead of triangles. It can be proven that if A ≥ B ≥ C and A ≤ B + C then this number is f(A) + f(B) + f(C) - f(A - B) - f(A - C) - f(B - C) where f(X) = 0 + 1 + ... + X(X - 1) / 2

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

      For C = 1, B = 3, A = 3 we got:

      f(3) + f(3) + f(1) — f(0) — f(2) — f(2) = 6 + 6 + 0 — 0 — 1 — 1 = 10 non triangles, but it is almost 1*3*3 = 9 combinations of al possible length values...

      Something wrong..

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

        f(3) = 3

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

          f(3) = 0 + 1 + ... + 3*(3-1)/2 = 0 + 1 + 2 + ... + 3 = 6 =)) LOL

          • »
            »
            »
            »
            »
            »
            9 years ago, # ^ |
            Rev. 2   Vote: I like it +3 Vote: I do not like it

            "First idea that you want to count number of non triangles, instead of triangles." Seriously, there are only 2 sentences. Please don't downvote someone who is trying to help because you are so impatient you can't read more than 1 sentence (speaking to everyone).

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

              But in my case number of non-triangles is MORE than maximum possible number of triple of lengths )))

              • »
                »
                »
                »
                »
                »
                »
                »
                9 years ago, # ^ |
                Rev. 2   Vote: I like it -16 Vote: I do not like it

                Okay a = 1, b = 3, c = 3. Number of triples = 1*3*3 = 9.

                Number of impossible = 6 as you calculated.

                9 — 6 = 3.

                Correct answer is 3.

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

                  Number of impossible triples = 6+6-1-1=10 is MORE than 9, as I calculated.

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

                  Ok I understand. You think f(x) = triangular number x. Actually f(x) = sum of first x-1 triangular numbers. So f(0) = 0, f(1) = 0, f(2) = 1, f(3) = 4, f(4) = 10 etc.

                  So f(3) + f(3) + f(1) — f(2) — f(2) — f(0) = 4 + 4 + 0 — 1 — 1 — 0 = 6.

                  9 — 6 = 3

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

                  Thank you!

          • »
            »
            »
            »
            »
            »
            9 years ago, # ^ |
              Vote: I like it -19 Vote: I do not like it

            My maths definitely needs improvement

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

      Can anyone provide me a proof/hint (intuitive/mathematical) for this?

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

      Interpolation of [0, 0, 1, 4] is f(x)=x(x+1)(x-1)/6

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

    Let A<=B<=C. My solution is O(C-B) and it passed system test in 1.8s :|
    In practice session though :(

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

How to solve 500?

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

The challenge phase, I don't hate you anymore. (I got to top40 thanks to one challenge)

How to solve 500p.?

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

    I was first before challenge phase and had no opportunity to get points (only other solution in my room was correct) :(

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

I read anta's code, so I am smart now and can tell how to solve 500 ;p.
1) Bag B is heaviest for permutation P if for every prefix of P there is no bag C which contains more gems from that prefix than B.
2) If bags are unique then heaviest bag is unique

For every bag B you can enumerate possible prefixes P can contain so that they do not violate B being heaviest and by subset dp you can count how many such permutations exist. Then you need to sum it over all B and check if that is equal to 16!.

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

    My approach was to check 10000 random permutations. I don't have a rigorous proof, but it seems that probability of false-positive / one iteration is at most 50/51.

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

Look here!

http://artofproblemsolving.com/community/c6h1248018_number_of_side_triplets_satisfying_an_inequality

EDIT1: Looks like he indeed deleted the topic. I'm glad I took the screenshot!

Also a screenshot in case he deletes it.

http://prntscr.com/b8nulc

  • »
    »
    9 years ago, # ^ |
    Rev. 5   Vote: I like it -187 Vote: I do not like it

    Yeah I made that. Didn't expect anyone to reply in contest. And exactly that happened..

    EDIT: If you regularly use AoPS, you would know that replies start turing in at least a day from making the post..

    EDIT2: Post was made in contest. Just around when 10 minutes or so of coding phase remaining.

    EDIT3: Checked carefully. Post was made 12 minutes before end of coding phase

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

      Why do you need replies on AoPS, you could have waited for the editorial :P

      • »
        »
        »
        »
        9 years ago, # ^ |
        Rev. 2   Vote: I like it -124 Vote: I do not like it

        Because that is a pure maths problem. And there can be much better discussion on a math forum. Either way, Topcoder problems are seldom discussed anywhere.

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

          Legit.

        • »
          »
          »
          »
          »
          9 years ago, # ^ |
          Rev. 2   Vote: I like it +55 Vote: I do not like it

          Why wouldn't you wait one more hour in order to create that AoPS topic after TCO round? :)

          • »
            »
            »
            »
            »
            »
            9 years ago, # ^ |
            Rev. 2   Vote: I like it -33 Vote: I do not like it

            Yeah, seems unfair. Topcoder admins could remove me if that seems more fair. Anyway, if my intent would have been to cheat, I wouldn't have posted it under my usual handle..

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

              It's bad to intend to cheat. It's forbidden to cheat. You did the latter one, unfortunately.

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

      "Yes, I asked for help in the Internet during the contest. I didn't expect the answer though, so it's fine, right?"

      :>

      • »
        »
        »
        »
        9 years ago, # ^ |
        Rev. 2   Vote: I like it -45 Vote: I do not like it

        I am not sure how one would expect someone on a forum to be able to solve a problem in 12 minutes, post the solution, and then me to be able to read it, understand it, and then code it. I honestly just wanted to know the solution(and was also thinking of getting some contrib on AoPS). I don't know if there is some way I could prove my innocence. :/

        P.S. Already had a lot of contrib-- on CF. Please don't down vote and understand my view point. :/

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

          Whispering: I think you just wanted to get the solution idea for hacking purpose, which could lead you to qualify for next rounds.

          • »
            »
            »
            »
            »
            »
            9 years ago, # ^ |
            Rev. 4   Vote: I like it 0 Vote: I do not like it

            I have nothing to say. I just applaud the ability of CF community to be completely biased against someone and not even think about this from someone else's perspective and de motivate them completely. If I really just wanted to cheat, why would I do so at the end of the contest. Using my own fucking handle. But this'll also probably just get down voted, so its no use trying to explain. I am just sorry about this. I won't do something like this again. Thats all I can say. :/

            It's just really saddening for me. All of this happened because of my impatience. Lesson learned, be patient and wait for end of contest. I guess I was just frustrated of being unable to solve anything. Anything and everything I did do and will do in the future will simply be labeled as cheating. Even though I had no such intents. I feel really sad.

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

              I think you are great for apologizing publicly, you get my upvote :)

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

      That's one of the lamest excuses I have ever heard xD

    • »
      »
      »
      9 years ago, # ^ |
      Rev. 4   Vote: I like it +21 Vote: I do not like it

      Correct me if I'm wrong, but it sounds like you think it's OK to post a problem from an active contest to a problem solving forum? Isn't that explicitly disallowed? From the topcoder rulebook:

      Collaborating in any way with anyone else (member or not) during a rated event is considered cheating. This includes discussing problem statements or solutions between the time that the coding phase begins and the time that the challenge phase ends.

      • »
        »
        »
        »
        9 years ago, # ^ |
          Vote: I like it -26 Vote: I do not like it

        No I do not. I am sorry if this comes of as cheating. It is actually a clear violation of rules, so I should rather just be disqualified. But I just wanted to be clear that I did not intend to cheat. Nor did I mean to break any rules. AoPS would never have replies in less than 24 hours unless topic is really hot.

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

Check out LayCurse's 300 point solution. How can you write something out like that and not make a mistake? The lines aren't even the same structure where you just paste and change variable names.

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

I start to like those rounds.

Round 2A — solved nothing, hacked nothing, rating goes 1395 -> 1398

Round 2B — solved nothing, hacked nothing, rating goes 1398 -> 1402

How more do I need to become red? :D

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

    Solved nothing, hacked nothing, 2606->2456

    I fear that limit of that sequence is below red :P.

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

      Can confirm. 1793 -> 1679 over the last two rounds.

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

    I'm also solved nothing, hacked nothing, 2091 -> 2153....

    There's even no any submission in my room(in parallel round).

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

    Seriously though, quality of problems aside, isn't it a bad contest if there is only differentiation between 122 contestants (of 734)?

    • »
      »
      »
      9 years ago, # ^ |
      Rev. 4   Vote: I like it 0 Vote: I do not like it

      I would say "YES, it is a bad contest". But sometimes it is difficult to estimate difficulty. :). So sometimes it happens :)

      And the first problem A proved to be simple — it's just (as posted by Egor above):

      f(A) + f(B) + f(C) - f(A - B) - f(A - C) - f(B - C) where f(X) = 0 + 1 + ... + X(X - 1) / 2

      How much simpler can it be? :) It's intuitive :)

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

        There are a lot of hard problems with simple solutions. Anyway, I'm not saying the 300 was a bad problem. Quality of problems aside, the last two contests have only differentiated between the top 10% of participants.

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

          I agree — it was a good problem. And problem A should be submitted (doesn't mean solved) by at least 50-75% of participants. Didn't work out this time. Ok, last two times.

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

      For a regular SRM round — yes problems were too hard. But the main purpose of the contest was to choose top 40 to advance, and 500 people with 0 is OK.

      It is defnitely better than 150 people with 300 and 500 solved, and the question is who codes faster.

      • »
        »
        »
        »
        9 years ago, # ^ |
        Rev. 2   Vote: I like it +20 Vote: I do not like it

        Good point. But it is a rated round as well.

        Why is it necessary for the easy problem to determine the top 40? For instance, in last year's round 2, the medium problems determined who advanced. More than half the participants were able to solve the easy. Not trying to pick a fight or anything — I'm just wondering why the format is so different this year.

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

          I would agree with this one. The easy problem should be a bit simpler so that people at least have more time to attempt other problems. That a lot of people either ended up with no problem submitted or spent half of their time solving the easy one makes the round less enjoyable in my opinion. By the way, using the easy problem to determine who will advance clearly increase the importance of challenge phase, which should be avoided due to the randomness of room division.

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

          I agree with this completely. There are 3 problems per contest and in both rounds qualification was mostly decided on the easiest one, it's both frustrating for many participants and a waste of good quality hard problems.

          I think a decent target would be something like:

          250 ~= 300 accepted submissions 500 ~= 60 accepted submissions 1000 ~= 10 accepted submissions

          with big bonus points if only one or two people get all three. This would generally imply that whoever qualifies either solved 250 + 500 with some speed or gambled on the 1000 and won.

          But in any case, (~100, ~10, ~0) is ridiculous.