Contributing
Authors: Nathan Wang, Benjamin Qi
Prerequisites
How to contribute!
Note that the USACO Guide has a public Github Repository. Feel free to contribute by submitting issues and Pull Requests!
Please help fix some of the issues on our Github Repository!
Ways to Contribute
Some examples:
Lesson
- Convert lists of resources to tables (Plat / Advanced).
- Add missing descriptions for sections, modules, or resources.
- All resources should have descriptions.
- Improve explanations for sample problems.
- If starred resource or editorial already has a good explanation, no need to repeat it.
- Improve implementations.
- Include code handling input & output.
- Should be consistent across languages.
- Adding modules!
Problems
- Convert lists of problems to tables (Plat / Advanced).
- Fix problem difficulties and tags.
- Add problems that are good examples of the module topic (and remove those that are not).
- Adding official editorial links.
- Those for USACO are automatically generated.
- Adding editorials.
- If no editorial exists, or if existing editorial could be improved.
- Or solution code in a different language, etc.
Writing Content
All modules are written in MDX (Markdown + JSX), with limited support from KaTeX and some custom components. You can check how an .mdx
file renders by pasting it in the live editor.
See the Content Documentation for more info.
Useful Links
- Markdown Cheat Sheet
- Markdown Table Generator
- StackEdit
- nice markdown editor
- supports Katex
- Sublime Text
.md
syntax highlighting is fine, is also ok for.mdx
- You can open a
.mdx
file and set syntax highlighting to be the same as.md
withView -> Syntax -> Open all with current extension as ... -> Markdown -> Markdown
.
Adding a Solution
Fork the GitHub repository.
If it doesn't already exist, create a new
mdx
file insolutions
including frontmatter, ex. the following inUSACO jan17-cow-dance-show.mdx
:--- id: usaco-690 source: USACO Silver 2017 January title: Cow Dance Show author: Óscar Garries --- [Official Analysis](http://www.usaco.org/current/data/sol_cowdance_silver_jan17.html) ## Explanation (add explanation here ...) Use `\texttt{}` around variable names with length *greater than one*, like so. Place long equations on separate lines with display math, and use `\cdot` instead of `*` to denote multiplication. $$ \texttt{arr}[i]=2\cdot (a+b+c+d+e)+\sum_{j=0}^{i-1}\texttt{arr}[j] $$ Some additional text styles which you might consider using: http://latexref.xyz/Font-styles.html http://applied-r.com/latex-font-styles/ $func(var)$ $\textit{func(var)}$ $\textrm{func(var)}$ $\text{func(var)}$ $\textsf{func(var)}$ $\textbf{func(var)}$ $\texttt{func(var)}$ ## Implementation **Time Complexity:** $\mathcal{O}(N\log^2N)$ ^ Format time complexity like this. Should appear outside of `<LanguageSection>` if it's the same for all implementations. <LanguageSection> <CPPSection> (add cpp code) </CPPSection> <PySection> (if you have Python code) </PySection> <JavaSection /> <!-- if you have no Java code --> </LanguageSection>
Keep file names and solution IDs consistent; namely, USACO IDs should correspond to the URL on usaco.org.
Add your implementation, following the conventions below. It is not necessary to add an alternative implementation in the same language as the official analysis (unless the alternative implementation takes a different approach or is written better / differently from the official implementation).
Add the solution ID (ex.
usaco-690
) as the last argument of theProblem
constructor in the corresponding module (in this case,Binary_Search_Ans.mdx
). Also add tags (if you want).new Problem( 'Silver', 'Cow Dance Show', '690', 'Easy', false, ['tag1', 'tag2'], 'usaco-690' ),
Check that both the module and the solution render properly using the live editor before submitting a pull request.
Code Conventions
Since code for the USACO Guide is contributed from several authors, code style will not be uniform. Of course, we still strive for code that is readable and understandable. If any code does not compile or is hard to read, please contact us.
Please read the following resources before contributing code (although you do not have to follow all of their recommendations):
Resources | |||
---|---|---|---|
MIT | Python-specific (but still generally useful) | ||
CF | C++-specific |
Additional Notes:
Use tabs to indent.
Don't use too many macros.
Lines should not exceed 80 characters.
Be consistent about formatting your code, unlike the following snippet:
a,b = (0,1)print(a+b)print(a + b)It doesn't matter which one you use (
a+b
ora + b
), but pick one and stick with it!
Module Progress:
Join the USACO Forum!
Stuck on a problem, or don't understand a module? Join the USACO Forum and get help from other competitive programmers!