To our students participating in the USACO competition, which started today and runs through Monday, you should pay careful attention to some last-minute new rules and format changes the organizers have stated on the December 2020 contest page. You can open this from the top paragraph on usaco.org. The rules about using prepared code and outside references have narrowed, and the input/output format to use in problems has changed to use “standard input and output” rather than reading and writing files. This will take some adjustment but is quite manageable with some attention and preparation, so don’t worry! More details below.
The rules about using external code are much stricter, and you should NOT use template code to get a head start on problems! You should review all practice problems and references BEFORE the contest starts, then write code from scratch using your code editor’s functionality. Remember to use your home code editor and not KTBYTE VMs to do your work. You may still consult official references on the oracle.com website, such as for Scanner, Map, PriorityQueue, etc, to remind yourself of method names and data types. The organizers state these changes are to make the contest experience more like the high-level International Olympiad of which USACO is a part.
HackerRank has a nice example problem showing how to open “standard input” with a Scanner, here: https://www.hackerrank.com/challenges/java-stdin-and-stdout-1/problem
We already practice using Scanner for files as in the HackerRank example, and you’ll be happy to know we have been using “standard output” every time we use System.out.println, so you actually already know everything you need to about these things! This means in the new format problems, you can also leave out any file-related code that we included on old problems, such as PrintWriter, .close(), FileNotFoundException, and so on. Obviously, you must replace the line that opens a file with the Scanner, with a line that opens System.in with a Scanner.
Eclipse and other editors allow you to type into the console, then press enter, to feed data to standard input. This will then be read by your Scanner automatically. When you first run the program, the program will wait for you to provide input before continuing – don’t get thrown off by the blank console! To test large data sets, it’s easiest to simply paste it into the console all at once, then press enter, and you should see your programs work just like they have before!
Remember to practice with these changes BEFORE you start the contest. Unfortunately, you cannot submit problems to the website in the new format yet other than in the live contest, but if you can paste input into the console and see correct output printed in response, you probably are using the right format!
2 Replies to “New USACO Rules!”
Hi there, I actually enjoy reading your entire article. I needed to create a very little comment to support you.
Thank you so much for your support!