diff --git a/content/1_Intro/About_This.md b/content/1_Intro/About_This.md index c9b1cd3..c7c9f38 100644 --- a/content/1_Intro/About_This.md +++ b/content/1_Intro/About_This.md @@ -13,17 +13,16 @@ author: Nathan Wang, Benjamin Qi ## Goals - Intended audience: anybody in Bronze - Gold. - - We are **not** teaching people how to code (but we'll provide some links for this purpose). + - We are **not** teaching people how to code (but some resources for this purpose are provided in "Prerequisites"). - should be a "one stop shop," meaning that this is the only site they have to use. - The idea is that people will no longer have to go resource hunting as we’ll do all of that for them. - For Bronze - Gold, most but not all problems on monthly contests will fall into the categories that we have designated. For Platinum, there are no guarantees. - Note that topics may cross divisions without warning! (ex. Gold seems to have more and more tree problems that used to be confined to Platinum). - Material will be grouped into **modules**. - - USACO-Focused: generally avoid covering topics that will not appear on USACO or IOI. - - Maybe designate some "optional" modules. + - USACO-Focused: Modules should generally stick to topics that can appear on USACO or IOI. - "Don’t Reinvent the Wheel" - - Should set guidelines as to what counts and what doesn’t. - Link to online resources that already exist. + - Should set guidelines as to what counts and what doesn’t. - Not *just* a collection of links - There exist plenty of resources out there. While we can link to all of them, we should not expect users to click through all of them to find the information they want. This means in addition to links we need to provide information about what the link talks about, as well as the quality of the link. - We don’t want to say something like “learn DP, here are 50 links that can teach you that.” Instead, we want to say “learn DP by first reading this one article, then reading this other article. For reference, here are some other links you can explore as you wish.” @@ -37,8 +36,8 @@ author: Nathan Wang, Benjamin Qi - Everything should be completed in order. - Any problems here should be pure implementation. - Languages - - Include C++, Java, Python for Bronze. - - Include C++, Java for Silver and beyond (C++ takes priority) + - Include C++ and Java for all divisions. (C++ takes priority) + - Possibly Python for Bronze. ### Practice diff --git a/content/1_Intro/Data_Types.md b/content/1_Intro/Data_Types.md index 526cce1..4bb09d4 100644 --- a/content/1_Intro/Data_Types.md +++ b/content/1_Intro/Data_Types.md @@ -12,12 +12,12 @@ There are several main **data types** that are used in contests: 32-bit and 64-b - CPH 1.1 - 1.3 -The 32-bit integer supports values between $-2\,147\,483\,648$ and $2\,147\,483\,647$, which is roughly equal to $\pm$ $2 \times 10^9$. If the input, output, or \textit{any intermediate values used in calculations} exceed the range of a 32-bit integer, then a 64-bit integer must be used. The range of the 64-bit integer is between $-9\,223\,372\,036\,854\,775\,808$ and $9\,223\,372\,036\,854\,775\,807$ which is roughly equal to $\pm$ $9 \times 10^{18}$. Contest problems are usually set such that the 64-bit integer is sufficient. If it's not, the problem will ask for the answer modulo $m$, instead of the answer itself, where $m$ is a prime. In this case, make sure to use 64-bit integers, and take the remainder of $x$ modulo $m$ after every step using `x %= m;`. +The **32-bit integer** supports values between $-2\,147\,483\,648$ and $2\,147\,483\,647$, which is roughly equal to $\pm$ $2 \times 10^9$. If the input, output, or \textit{any intermediate values used in calculations} exceed the range of a 32-bit integer, then a **64-bit integer** must be used. The range of the 64-bit integer is between $-9\,223\,372\,036\,854\,775\,808$ and $9\,223\,372\,036\,854\,775\,807$ which is roughly equal to $\pm$ $9 \times 10^{18}$. Contest problems are usually set such that the 64-bit integer is sufficient. If it's not, the problem will ask for the answer modulo $m$, instead of the answer itself, where $m$ is a prime. In this case, make sure to use 64-bit integers, and take the remainder of $x$ modulo $m$ after every step using `x %= m;`. -Floating point numbers are used to store decimal values. It is important to know that floating point numbers are not exact, because the binary architecture of computers can only store decimals to a certain precision. Hence, we should always expect that floating point numbers are slightly off. Contest problems will accommodate this by either asking for the greatest integer less than $10^k$ times the value, or will mark as correct any output that is within a certain $\epsilon$ of the judge's answer. +**Floating point numbers** are used to store decimal values. It is important to know that floating point numbers are not exact, because the binary architecture of computers can only store decimals to a certain precision. Hence, we should always expect that floating point numbers are slightly off. Contest problems will accommodate this by either asking for the greatest integer less than $10^k$ times the value, or will mark as correct any output that is within a certain $\epsilon$ of the judge's answer. -Boolean variables have two possible states: `true` and `false`. We'll usually use booleans to mark whether a certain process is done, and arrays of booleans to mark which components of an algorithm have finished. +**Boolean** variables have two possible states: `true` and `false`. We'll usually use booleans to mark whether a certain process is done, and arrays of booleans to mark which components of an algorithm have finished. -Character variables represent a single Unicode character. They are returned when you access the character at a certain index within a string. Characters are represented using the ASCII standard, which assigns each character to a corresponding integer. This allows us to do arithmetic with them; for example, both `cout << ('f' - 'a');` in C++ and `System.out.print('f' - 'a');` in Java will print `5`. +**Character** variables represent a single Unicode character. They are returned when you access the character at a certain index within a string. Characters are represented using the ASCII standard, which assigns each character to a corresponding integer. This allows us to do arithmetic with them; for example, both `cout << ('f' - 'a');` in C++ and `System.out.print('f' - 'a');` in Java will print `5`. -Strings are stored as an array of characters. You can easily access the character at a certain index and take substrings of the string. String problems on USACO are generally very easy and don't involve any special data structures. +**Strings** are stored as an array of characters. You can easily access the character at a certain index and take substrings of the string. String problems on USACO Bronze or Silver generally don't involve any special data structures. \ No newline at end of file diff --git a/content/1_Intro/Example_Problem.md b/content/1_Intro/Example_Problem.md index bd8ae7a..fe150cd 100644 --- a/content/1_Intro/Example_Problem.md +++ b/content/1_Intro/Example_Problem.md @@ -7,6 +7,11 @@ problems: - bronze_word - bronze_paint - bronze_square +prerequisites: + - + - Intro - Data Types + - + - Intro - Input & Output --- Solutions for an example USACO problem in multiple languages. @@ -70,11 +75,6 @@ int main() { ### Java -(link?) - -(Scanner?) - -(FastScanner?) Class name can be whatever you want. (?) @@ -103,6 +103,7 @@ public class paintSol { // must be declared in paintSol.java ``` Alternatively, an InputReader class that functions very similarly to Scanner but has the faster runtime of BufferedReader. + ```java import java.util.*; import java.io.*; diff --git a/content/1_Intro/Getting_Started.md b/content/1_Intro/Getting_Started.md index 50615a8..2eaa73b 100644 --- a/content/1_Intro/Getting_Started.md +++ b/content/1_Intro/Getting_Started.md @@ -10,14 +10,9 @@ author: Nathan Wang, Benjamin Qi, Darren Yao - -Todo: - - - Video clip from Brian Dean? - ## Introduction -The goal of competitive programming is to write code to solve given problems quickly. These problems are not open problems; they are problems that are designed to be solved in the short timeframe of a contest, and have already been solved by the problem writer(s) and tester(s). In general, each problem in competitive programming is solved by a two-step process: coming up with the algorithm, which involves problem solving skills and intuition, and implementing the algorithm, which requires programming skills to translate the algorithm into working code. +The goal of **competitive programming** is to write code to solve given problems quickly. These problems are not open problems; they are problems that are designed to be solved in the short timeframe of a contest, and have already been solved by the problem writer(s) and tester(s). In general, each problem in competitive programming is solved by a two-step process: coming up with the algorithm, which involves problem solving skills and intuition, and implementing the algorithm, which requires programming skills to translate the algorithm into working code. A contest generally lasts for several hours and consists of a set of problems. For each problem, when you complete your code, you submit it to a grader, which checks the answers calculated by the your program against a set of predetermined test cases. For each problem, you are given a time limit and a memory limit that your program must satisfy. diff --git a/content/1_Intro/Input_Output.md b/content/1_Intro/Input_Output.md index 9829111..1dfa5c0 100644 --- a/content/1_Intro/Input_Output.md +++ b/content/1_Intro/Input_Output.md @@ -10,16 +10,14 @@ Demonstrates how to read input and print output for USACO. ## C++ -In CodeForces and CSES, input and output are standard, meaning that using the library [](http://www.cplusplus.com/reference/iostream/) suffices. +In CodeForces and CSES, input and output are **standard**, meaning that using the library [\](http://www.cplusplus.com/reference/iostream/) suffices. -However, in USACO, input is read from a file called `problemname.in`, and printing output to a file called `problemname.out`. Note that you'll have to rename the `.in` and `.out` files. You will need the [](http://www.cplusplus.com/reference/cstdio/) or the [](http://www.cplusplus.com/reference/fstream/) library. Essentially, replace every instance of the word *template* in the word below with the input/output file name, which should be given in the problem. +However, in USACO, input is read from a file called `problemname.in`, and printing output to a file called `problemname.out`. Note that you'll have to rename the `.in` and `.out` files. You will need the [\](http://www.cplusplus.com/reference/cstdio/) or the [\](http://www.cplusplus.com/reference/fstream/) library. Essentially, replace every instance of the word *template* in the word below with the input/output file name, which should be given in the problem. In order to test a program, create a file called `problemname.in`, and then run the program. The output will be printed to `problemname.out`. Below, we have included C++ templates for input and output. We use `using namespace std;` so that we don't have to preface standard library functions with `std::` each time we use them. -For USACO: - If `` is used: ```cpp diff --git a/content/1_Intro/Practicing.md b/content/1_Intro/Practicing.md index 603bea7..ab5b62d 100644 --- a/content/1_Intro/Practicing.md +++ b/content/1_Intro/Practicing.md @@ -1,7 +1,7 @@ --- id: practicing title: How to Practice -author: Benjamin Qi, William Lin, Eric Wei, Nathan Wang, Nathan Chen, Darren Yao +author: Many --- How to practice, when to read editorials (analyses), etc. diff --git a/content/2_General/Proposing.md b/content/2_General/Proposing.md index f18ba2d..1f97b56 100644 --- a/content/2_General/Proposing.md +++ b/content/2_General/Proposing.md @@ -4,11 +4,13 @@ title: Proposing Problems for USACO Monthlies author: Benjamin Qi --- -Anyone can propose problems for monthly contests (email your proposal to Professor Dean). +Anyone can propose problems for monthly contests. -In the [past](http://www.usaco.org/index.php?page=viewproblem2&cpid=817), contestants have even written problems for their own divisions! +Email your proposal to Professor Dean. In the [past](http://www.usaco.org/index.php?page=viewproblem2&cpid=817), contestants have even written problems for their own divisions! + +All problems should have 10 test cases at minimum (I believe that the maximum was 21 for [valleys](http://www.usaco.org/index.php?page=viewproblem2&cpid=950)). All statements must eventually be converted to the following format; please save us time by following it as best you can. diff --git a/content/2_General/Resources.md b/content/2_General/Resources.md index a7c3e85..0fd313e 100644 --- a/content/2_General/Resources.md +++ b/content/2_General/Resources.md @@ -4,7 +4,7 @@ title: Additional Resources author: Benjamin Qi --- -Helpful Links! Some (such as CPH and Intro to USACO) will be mentioned again in later modules. +Helpful Links! Some (such as **CPH** and **Intro to USACO**) will be mentioned again in later modules. diff --git a/content/3_Bronze/Cpp_Containers.md b/content/3_Bronze/Cpp_Containers.md index 50965f3..b92874b 100644 --- a/content/3_Bronze/Cpp_Containers.md +++ b/content/3_Bronze/Cpp_Containers.md @@ -4,7 +4,7 @@ title: Built-In C++ Containers author: Darren Yao --- -Introduces the data structures in the C++ standard library that are frequently used in competitive programming. +Introduces C++ [containers](http://www.cplusplus.com/reference/stl/) that are frequently used in competitive programming. diff --git a/content/3_Bronze/DS.md b/content/3_Bronze/DS.md index ec34871..735dd89 100644 --- a/content/3_Bronze/DS.md +++ b/content/3_Bronze/DS.md @@ -12,9 +12,10 @@ Problems and additional resources regarding built-in data structures. ## Problems **CSES:** + Do roughly the first half of the Sorting and Searching section in the [CSES Problem Set](https://cses.fi/problemset/) -(actually go through these ...) +(actually go through these and check ...) **Stack:**: - UVa 00514 - Rails diff --git a/content/3_Bronze/Java_Collections.md b/content/3_Bronze/Java_Collections.md index d7c114e..940e4f7 100644 --- a/content/3_Bronze/Java_Collections.md +++ b/content/3_Bronze/Java_Collections.md @@ -4,7 +4,7 @@ title: Built-In Java Collections author: Darren Yao --- -Introduces the data structures in the Java standard library that are frequently used in competitive programming. +Introduces data structures from Java [Collections](https://docs.oracle.com/javase/7/docs/api/java/util/Collections.html) that are frequently used in competitive programming. diff --git a/content/3_Bronze/Simulation.md b/content/3_Bronze/Simulation.md index 5723aec..afd1d0e 100644 --- a/content/3_Bronze/Simulation.md +++ b/content/3_Bronze/Simulation.md @@ -4,12 +4,11 @@ title: "Simulation" author: Darren Yao --- -In many problems, we can simply simulate what we're told to do by the problem statement. +In many problems, we can **simulate** what we're told to do by the problem statement. - -Since there's no formal algorithm involved, the intent of the problem is to assess competence with one's programming language of choice and knowledge of built-in data structures. At least in USACO Bronze, when a problem statement says to find the end result of some process, or to find when something occurs, it's usually sufficient to simulate the process. +Since there's no formal algorithm involved, the intent of the problem is to assess competence with one's programming language of choice and knowledge of built-in data structures. At least in USACO Bronze, when a problem statement says to find the end result of some process, or to find when something occurs, it's usually sufficient to simulate the process naively. ## Example 1 diff --git a/content/4_Silver/Binary_Search.md b/content/4_Silver/Binary_Search.md index cfed147..5f0c3d5 100644 --- a/content/4_Silver/Binary_Search.md +++ b/content/4_Silver/Binary_Search.md @@ -42,6 +42,7 @@ Other variations are similar, such as the following: - [upper_bound](http://www.cplusplus.com/reference/algorithm/upper_bound/) ### Problems + - [USACO Silver Counting Haybales](http://www.usaco.org/index.php?page=viewproblem2&cpid=666) ## Binary Searching on the Answer diff --git a/content/4_Silver/Greedy.md b/content/4_Silver/Greedy.md index 431a2ac..ef18797 100644 --- a/content/4_Silver/Greedy.md +++ b/content/4_Silver/Greedy.md @@ -4,14 +4,18 @@ title: "Greedy Algorithms" author: Darren Yao --- -**Greedy algorithms** are algorithms that select the optimal choice at each step instead of looking at the solution space as a whole. This reduces the problem to a smaller problem at each step. +**Greedy** algorithms select the optimal choice at each step instead of looking at the solution space as a whole. This reduces the problem to a smaller problem at each step. +Greedy does not refer to a single algorithm, but rather a way of thinking that is applied to problems. There's no one way to do greedy algorithms. Hence, we use a selection of well-known examples to help you understand the greedy paradigm. + +Usually, when using a greedy algorithm, there is a heuristic or value function that determines which choice is considered most optimal. + +(convert Intro to USACO Chapter 9, Interval Cover) + # Tutorials - - Intro to USACO, Chapter 9 - - Interval Cover - CPH 6 - [CPC.5](https://github.com/SuprDewd/T-414-AFLV/tree/master/05_greedy_algorithms) diff --git a/content/4_Silver/Sorting.md b/content/4_Silver/Sorting.md index 41ebd60..8213d1b 100644 --- a/content/4_Silver/Sorting.md +++ b/content/4_Silver/Sorting.md @@ -4,7 +4,7 @@ title: "Sorting" author: Siyong, Michael Cao prerequisites: - - - Silver - Containers + - Bronze - Data Structures ---
Description: Todo diff --git a/content/5_Gold/BIT.md b/content/5_Gold/BIT.md index 4c7e976..6a9d083 100644 --- a/content/5_Gold/BIT.md +++ b/content/5_Gold/BIT.md @@ -10,7 +10,7 @@ prerequisites: A **Binary Indexed Tree** allows you to perform the following tasks in $O(\log N)$ time each on an array of size $N$: - Update the element at a single position (point). - - Querying the sum of a prefix of the array. + - Query the sum of a prefix of the array. diff --git a/content/ordering.js b/content/ordering.js index 436153e..9e39778 100644 --- a/content/ordering.js +++ b/content/ordering.js @@ -1,7 +1,7 @@ const ModuleOrdering = { "intro": [ - "about-this", "getting-started", + "about-this", "prereqs", "running-cpp", "data-types", @@ -38,8 +38,8 @@ const ModuleOrdering = { "sorting", "binary-search", "2P", - "prefix-sums", "data-structures", + "prefix-sums", "dfs" ], "gold": [