xiaowuc1's blog

By xiaowuc1, 21 month(s) ago, In English

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.

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

| Write comment?
»
21 month(s) ago, # |
  Vote: I like it 0 Vote: I do not like it

:skull: Here we go again

»
21 month(s) ago, # |
  Vote: I like it +9 Vote: I do not like it

road to a positive score on plat #1

»
21 month(s) ago, # |
  Vote: I like it +17 Vote: I do not like it

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.

  • »
    »
    21 month(s) ago, # ^ |
      Vote: I like it +8 Vote: I do not like it

    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.

    • »
      »
      »
      21 month(s) ago, # ^ |
        Vote: I like it +11 Vote: I do not like it

      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?

      • »
        »
        »
        »
        21 month(s) ago, # ^ |
          Vote: I like it +23 Vote: I do not like it

        you'd need a lot more interest and funding

        • »
          »
          »
          »
          »
          21 month(s) ago, # ^ |
            Vote: I like it +4 Vote: I do not like it

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

        • »
          »
          »
          »
          »
          21 month(s) ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

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

      • »
        »
        »
        »
        21 month(s) ago, # ^ |
        Rev. 4   Vote: I like it +4 Vote: I do not like it

        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.

»
21 month(s) ago, # |
  Vote: I like it +13 Vote: I do not like it

letsgoo

»
21 month(s) ago, # |
  Vote: I like it 0 Vote: I do not like it

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!

»
21 month(s) ago, # |
Rev. 4   Vote: I like it -10 Vote: I do not like it

[DELETED]

»
21 month(s) ago, # |
Rev. 2   Vote: I like it +16 Vote: I do not like it

Maybe Plat?

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

»
21 month(s) ago, # |
  Vote: I like it +56 Vote: I do not like it

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

rip to anyone who has their contest window running rn

»
21 month(s) ago, # |
  Vote: I like it 0 Vote: I do not like it

Hope to make gold this or next contest

»
20 months ago, # |
  Vote: I like it 0 Vote: I do not like it

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

  • »
    »
    20 months ago, # ^ |
      Vote: I like it +12 Vote: I do not like it

    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.

»
20 months ago, # |
  Vote: I like it 0 Vote: I do not like it

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

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

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

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

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

    • »
      »
      »
      20 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Very nice, thanks!

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

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

      EDIT: P2, not P3

      • »
        »
        »
        »
        20 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Do you mean P2?

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

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

    • »
      »
      »
      20 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      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.

      • »
        »
        »
        »
        20 months ago, # ^ |
          Vote: I like it +23 Vote: I do not like it

        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.

    • »
      »
      »
      20 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      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.

      • »
        »
        »
        »
        20 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

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

        • »
          »
          »
          »
          »
          20 months ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          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.

        • »
          »
          »
          »
          »
          20 months ago, # ^ |
            Vote: I like it +35 Vote: I do not like it

          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

        • »
          »
          »
          »
          »
          20 months ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          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.

      • »
        »
        »
        »
        20 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

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

»
20 months ago, # |
  Vote: I like it 0 Vote: I do not like it

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

»
20 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Can someone give hint for problem A in Silver?

  • »
    »
    20 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

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

    • »
      »
      »
      20 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      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)

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

        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.

»
20 months ago, # |
  Vote: I like it 0 Vote: I do not like it

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?