Блог пользователя chrome

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

Привет!

Менее чем через 24 часа, а точнее в 14:00 MSK состоится TCO16 Round 2A.

Прочитать про TCO16 можно здесь.

И еще, количество участников ограничено, только 2500, и максимальное количество участников которые проходят на следующий тур — 40.

Предлагаю обсудить задачи после контеста. GL && HF!!!

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

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

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

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

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?

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

    They can.

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

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

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

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

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

    :) Does anybody know the solution of 1000?

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

      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.

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

        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 :(

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

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.

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

    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

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

      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..

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

        f(3) = 3

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

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

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

            "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).

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

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

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

                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.

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

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

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

                  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

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

                  Thank you!

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

            My maths definitely needs improvement

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

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

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

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

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

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

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

How to solve 500?

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

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

How to solve 500p.?

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

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

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

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!.

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

    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.

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

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

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

    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

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

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

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

        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.

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

          Legit.

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

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

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

            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..

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

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

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

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

      :>

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

        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. :/

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

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

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

            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.

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

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

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

      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.

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

        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.

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

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.

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

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

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

    Solved nothing, hacked nothing, 2606->2456

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

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

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

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

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

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

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

      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 :)

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

        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.

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

          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.

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

      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.

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

        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.

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

          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.

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

          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.

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

Какая же потрата этот ваш топкодер последнее время.