# USACO Training & Competition Results

The 2019-20 USA Computing Olympiad (USACO) season recently concluded, and we are proud to recognize the Juni students who successfully advanced into a new division this season.

**Timucin Erbas**, RJ Grey Junior High School, Acton, Massachusetts*"I have been training for USACO for 4 months. With my instructor Tylan we practiced for USACO weekly. Tylan has been a great instructor. He has helped me figure out the problems that I did not know how to solve. I learned a lot from these 4 months of USACO competitions."***Aman Saridena**, Foster Middle School, Longview TX*I joined Juni Learning last March, had no prior exposure to programming and was little bit nervous, but immediately put to ease by Kaizen who was assigned as my instructor. I want to thank Kaizen for training me, and Juni Learning for giving me an early chance to participate in USACO.***Aristotle Yang**, Monta Vista High School, Cupertino, California*I spent about a year preparing for the USACO contest with Juni Learning. I solved old problems and my instructor gave me advice for my approach to solving the problem and helped debug my code when errors occurred. My instructor made me feel confident about passing the contest and I did. I want to thank Ruby for helping me pass Bronze and getting me one step closer to the Platinum division! My instructor was great!***Bhuvan Balagar**, Monta Vista High School, Cupertino, California*"Juni Learning is an awesome online website to pursue your software learning career. The online 1:1 face to face classes are like you are learning with your teacher in front of you. The flexibility to adjust class timings in case of your unavoidable circumstances are really admirable. My problem solving skills have improved a lot since I joined and I’m still learning a lot. My current instructor, David, is nice and takes time in teaching topics so that I can understand them fully. I recommend Juni Learning to students interested in software learning.***Ethan Rowe**, Homeschooled/Dual-Enrolled at Schoolcraft College, Milford, Michigan*"I looked forward to my programming sessions with Chris and learned so much. The strategies I learned helped me achieve a Silver. I find that I’m also using these problem solving techniques in my courses at school. Thanks for everything, Chris!"***Samson Rozansky**, Ligon Middle School, Raleigh, North Carolina"Maya helped me a lot to prepare for USACO. She explains algorithms really well but at the same time lets me figure out problems on my own. She is an excellent instructor!"

**Alex Kawaja**, Woodside Priory, Portola Valley, California*"My instructor taught me how to think about the USACO problems in a much clearer way and really helped me through the Bronze league."***Armaan Chandak**, St. Louis MICDS School, St. Louis, Missouri*"Juni Learning has helped Armaan on concepts around problem solving and advanced topics like graphs."***Shiva Oswal**, Seven Springs Academy, Cupertino, California*Special congratulations to Shiva for advancing to the USACO Platinum Division this season!***Sahithi Ankireddy**, James B. Conant High School, Hoffman Estates, Illinois**Rahul Prasad**, Accel Middle College, San Jose, California**Dhruv Mangtani****Julie Li****Martin Ma****Ryan (Max) Lo****Haibo Yin****Autin Mitra****Ishaan Singh****Amy Metrick**- Two other students who wish to remain anonymous!

## USACO Preparation & Training

We've previously written extensively about our USACO Training Program, how the contest is structured, and what we cover in our courses for USACO levels Bronze, Silver, and Gold to prepare students for this programming competition. Here, we write further about the **structured approach** our Juni instructors are trained in to work with their students on USACO problems.

## USACO Problems: Structured Approach

Although USACO problems vary in the algorithms and technique they test, students benefit from following the structured approach outlined below to tackle every problem. The main idea behind this approach is to **plan before you code**, to avoid wasting critical time in competition writing code that ultimately is not solving the right problem. At Juni, we strive to instill this approach in our students starting at the Bronze level.

We describe the approach below using a simple Bronze problem, Square Pasture, as an example.

### 1. Read the problem for understanding

First, read the problem thoroughly, making sure you understand what the problem is asking, even if you don't have any ideas about how to solve it quite yet. Our instructors typically ask our students to read the problem outloud and explain it back in their own words, checking for understanding of the key details.

In Square Pasture, a summary of the problem the student might provide is: "This problem gives us the coordinates of the lower-left and upper-right corner of two different rectangles. We want to draw the smallest square where the area covered by these two rectangles is still contained, and we want to output what the area of this square must be."

### 2. Solve the sample case by hand

Each problem always provides a sample input case and its corresponding output solution. Solving this sample case by hand, we can start to see what the approach and some patterns might be. In the case of Square Pasture, we draw out the two rectangles on a grid and see that if we draw the outer rectangle that surrounds both inner rectangles, one side has length 4 and the other has length 7. Thus, since the final field has to be a square and cover the entire region, it must have area 7*7 = 49.

### 3. Generalize your approach for the sample case

Looking back at the approach you took for the sample case, what generalizable steps did you have to take? In Square Pasture, we had to determine the side lengths of the surrounding rectangle. Once we had the side lengths, it was simple to find the square's area. Thinking a bit deeper, we can see that one of the side lengths is simply the difference between the smallest and largest x-coordinate given, and the other is the difference between the smallest and largest y-coordinate given.

### 4. Plan out your algorithm and data structures

From step 3, we can now note down the step-by-step approach we'll take to the problem. From this, we can plan out how we will store the data needed. The steps for Square Pasture might look like:

- Read in the coordinates as a list of pairs
- Find and store the min and max x- and y-coordinates
- Find and store the width and height of the outer rectangle
- Output the answer: the larger of the width or height, squared

Remember to also approximate the algorithmic runtime of this approach, on the largest possible input size, to make sure it's within bounds.

### 5. Think through edge cases

A number of the test cases each USACO problem grades may be edge cases, where the input data might not look like what you initially think up. Square Pasture is fairly limited, because the input data always contains 8 numbers and the numbers are limited between 0 and 10. In other problems, you might ask yourself: what happens if some of these numbers are the same? What happens if the input is as large as the problem allows?

### 6. Implement

Now that we've gotten to this step, we should have a very good idea of the code we are writing. We won't go into any coding-specific tips here, but remember, it's okay to spend more time planning than coding!

### 7. Submit for testing

Because USACO does not penalize for number of attempts, you can submit for testing as soon as you believe you have a working program.

### 8. Write test cases to fix bugs

If your program is not passing certain test cases, in competition, you will not be able to see which test cases it is failing. Thus, come up with your own test cases which produce incorrect results when run through your code, to help debug your submission.

**Congratulations** again to all of the recognized students, and best of luck to all who are already starting to prepare for next season!