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

Автор xiaowuc1, 22 месяца назад, По-английски

Hi all,

The third contest of the 2022-2023 USACO season will be running from February 24th to February 27th. Good luck to everyone! Please wait until the contest is over for everyone before discussing anything contest-related (including but not limited to your scores or anything about the problems).

For those unfamiliar with the USACO contest format, please refer to the contest instructions and rules. We provide a short FAQ but folks should read all the rules carefully.

I have a question about the contest. Where do I ask it?

Email the contest director via the instructions above. Do not post anything publicly about the questions (including but not limited to your scores, how you felt about the problems, any content of the problems, etc) until after the contest is over for everyone. Do not DM me or anyone else affiliated with USACO, only the contest director can assist you. The contest director does not monitor Codeforces, this blog post is merely a courtesy to inform other people of the contest.

When can I enter the contest?

The contest will open on February 24th.

If I submit multiple programs, which one gets evaluated?

Only the last submission will be evaluated for official scoring purposes.

Can I use prewritten code / templates?

No.

Am I allowed to use outside resources during the contest?

You may only refer to language documentation.

Why didn't I get an email from USACO when I registered my account?

Follow the directions on the USACO website regarding Gmail Delivery Issues to contact the contest director.

Can I solve problems in Rust?

No, the only languages supported are C, C++, Java, and Python. Consult the instructions for language-specific technical details.

Will Rust support be added?

Petition IOI to add Rust support first.

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

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

:skull: Here we go again

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

road to a positive score on plat #1

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

When will the USACO team put any more measures into preventing cheating? At the moment, there is literally nothing stoping somebody from asking a friend for the a screenshot of the questions in advance, or just asking for a solution. Even if hundreds of people are caught cheating, there are surely hundreds of others that get away with it. The 4 day period is absolutely unnecessary. Why not just make it 4 hours? I doubt it would affect the participation numbers in the United States for silver and above. Also, how does is the prewritten code and outside resources rules supposed to be enforced? Having a rule that does nothing only hinders the integrity of the competition.

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

    It would seriously hurt participation numbers. Most top contenders don't cheat because they have respect for competitive programming. The main goals of USACO are to increase interest in informatics and eventually select the IOI team, both of which the current system does pretty well on despite flaws.

    If you have good way to prevent the (probably minimal) cheating without hindering those goals, it would be great, but your current suggestions hurt maximizing participation and awareness.

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

      I've always had this thought, but what about administering the USACO like the AMC? Schools send proctors to watch the students, like an actual exam in a set time period. Or, like the SAT, where students can go to designated testing sites all over the country?

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

        you'd need a lot more interest and funding

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

          a lot more is sort of an understatement in our area :(

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

          Actually, you don't need funding for that. All you need is something like Proctorio.

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

        The USACO is just not as famous as the AMC.

        12835 users (it's important to understand the difference between users and actual people; one person can have two accounts) logged into the contest in the 4 day span in January in the entire world. 4773 people took the USACO in the USA.

        In the entire world, last year, we had 71143 students take the AMC8 (and we know there are no duplicates, since the AMC8 is properly proctored). 68214 people took the AMC8 in the USA.

        To be perfectly honest, less people care about USACO than AMC tests.

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

letsgoo

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

only 167/1000 on plat last time :(

although i haven't practiced much competitive programming, i still hope to improve my score and maybe solve a problem!

»
22 месяца назад, # |
Rev. 4   Проголосовать: нравится -10 Проголосовать: не нравится

[DELETED]

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

Maybe Plat?

Edit: Bricked Gold hard. Need some more practice :(

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

lol someone got too pissed and decided to ddos usaco :/

rip to anyone who has their contest window running rn

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

Hope to make gold this or next contest

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

I learned the hard way not to ever spent my whole 4 hours on a problem made by Benjamin Qi What was that silver P1

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

    Historically, I've aced all problems not written by Benq in-contest. But I also get like 0 cases on his, so I can never pass silver. Hopefully cutoff will be 700 for silver this time again.

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

Heyy, can anyone share their solution to Plat P1 or P3 ?

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

    P1: If Farmer John only adds haybales, we can solve the problem by maintaining a segtree/BBST of unused time intervals, using binary-search-on-segtree to find how long the new haybale lasts. Then, we can use a standard trick where we divide-and-conquer on updates/queries in order make the updates incremental-only.

    Think of each haybale update as an interval of queries which it affects before it's overwritten. We can essentially form a segtree over the queries, and each update applies to $$$O(\log(U))$$$ nodes of this segtree. Then, we'll dfs through this segtree, when we reach a node, we apply all updates which cover that node, and then recurse into its children; when we're ready to leave the node, roll back all updates. This takes $$$O(U \log^2(U))$$$ time.

    P3: My solution is pretty funny. Note that, as K increases, we should take a superset of the previous vertices, since adding more vertices only decreases marginal costs of adding more. Also, we can solve the problem for a single value of K using a simple tree-dp of whether we use each vertex or not.

    Now, let's run the DP solve the problem for each value of K from 1 to N, using a few optimizations. First, before running anything, let's prune the tree of useless leaves (which don't have any special nodes) and then compress long paths of non-special vertices. Next, when we solve a future value of K, only do the tree-dp starting from unused edges/vertices; we can do this by maintaining a list of unused edges and shrinking it as we use them.

    Now, because we compressed the tree, the number of unused compressed edges is at most twice the current number of components. Furthermore, after running for K iterations, the current number of components is at most N/K + 1, since otherwise we could just take all vertices. Thus, if we run the tree-dp only on the unused portions of the compressed tree, our total runtime is at most $$$N/1 + N/2 + ... = O(N \log(N))$$$

    EDIT: Actually, the runtime of this algorithm is $$$O(N)$$$. Note that, after solving a particular value of $$$K$$$, the number of connected components is at most $$$ans[K] - ans[K-1]$$$; otherwise, we would have a better solution for $$$K-1$$$. Thus, if we add these all up, the total runtime is at most $$$ans[N] - ans[0] + O(N)$$$. We know that $$$ans[N] \le 2N$$$, so the total runtime is $$$O(N)$$$.

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

      wow, your solution to p3 is so clever :O orz

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

      Very nice, thanks!

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

      By the way, for P3, optimized $$$O(3^N)$$$ works (even though it shouldn't).

      EDIT: P2, not P3

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

        Do you mean P2?

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

          (oops I realized I replied to your post and not the original blog post)

          Yes P2. It was the one about finding the maximum size subset where each element is submask or supermask of each other.

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

      Can you send your code for P1? I did the same thing in contest (using a persistent segtree with insert-only modification) and I couldn't avoid MLEing.

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

        Yeah, you probably don't want black-box persistent segtree, I used essentially a count-min segtree so I could mark range and unmark range.

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

      Very nice! My solution for P1 and P3 is just some brainless sqrt, it's not interesting and you need to know how to constant optimize well.

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

        How did you do sqrt? I couldn't really come up with anything good.

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

          For P3,the answer is in the form of kx+b.It is no more than 2n.Use different ways to solve the k*k>2*n and k*k<=2*n two parts.

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

          For problem 1, I just divided queries into sqrt blocks (say $$$B$$$). Then all haybales except $$$B$$$ are "static" — preprocess them, and naively compute the added amount for non-static haybales.

          For problem 3, there are at most $$$\sqrt n$$$ points in convex hull, I pruned so that collinear points are not computed again.

          Geothermal My implementation of P3 contains a specific technique to reduce constant. In the tree DP, if you relabel the vertices per DFS ordering, the cache miss is greatly reduced. I don't know why this works well, but someone told me. Probably, the worst case per cache miss is achieved when the tree is a line, and in this case this heuristic works very well. This optimization alone can make the TL(>3s) code into <1s.

          Codes

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

          Maybe, you can obtain another $$$O(U \log^2 U)$$$ solution for P1 in this direction, similar to offline dynamic MST. This could be good, in the sense that you may not need to know how to solve the incremental version in a non-amortized fashion.

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

        Can I see your code? I'm especially interested in seeing how you were able to constant optimize the sqrt solution to P3 (I implemented ecnerwala's solution in-contest, which was not especially pleasant either...).

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

Damn scored 767, hope I can get to gold this time

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

Can someone give hint for problem A in Silver?

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

    How to check if a number of moonies can satisfy the requirement?

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

      I believe the answer is with a double binary search: you would first binary search on the number of moonies, then binary search on the optimal number of money to allot to either cookies or muffins --> I've heard that doing both and finding an answer in a common interval is the best way to do it, but I wouldn't know--this was an impl heavy problem that I unfortunately failed :(

      there's also a way you can do it with math but I've got like no clue how that works (again, something to do with intervals i think)

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

        The interval method is what I used during the contest. Try to find an interval of moonies to spend on cookies that can satisfy each cow, and see if a certain number of moonies is in all of these intervals.

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

I solved Silver P1 by doing ternary search + binsearch twice(on A and B, then vice versa). Is there any proof for this or is it wrong?