Update to latest version #4

Merged
Ta180m merged 123 commits from master into master 2020-06-18 19:15:27 +00:00
12 changed files with 51 additions and 42 deletions
Showing only changes of commit 1abd013e7b - Show all commits

View file

@ -12,9 +12,12 @@ author: Nathan Wang, Benjamin Qi, Darren Yao
## 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:
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.
1. coming up with the algorithm, which involves problem solving skills and intuition
2. 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 (usually 2 seconds) and a memory limit (usually 256 megabytes) that your program must satisfy.
For those of you with experience in software development, note that competitive programming is quite different, as the goal is to write programs that compute the correct answer, run quickly, and can be implemented quickly. Note that nowhere was maintainability of code mentioned. This means that you should throw away everything you know about traditional code writing; you don't need to bother documenting your code, because it only needs to be readable to you, during the contest.

View file

@ -87,10 +87,12 @@ Read the editorial when you feel like you've stopped making progress; that could
## William Lin
> I follow three guidelines (from most important to least important)
> 1. Having fun, just doing whatever you feel like doing
> 2. Spend about the same amount of time that you would be able to during a real contest
> 3. Whether you are making progress or not
I follow three guidelines (from most important to least important)
1. Having fun, just doing whatever you feel like doing
2. Spend about the same amount of time that you would be able to during a real contest
3. Whether you are making progress or not
## Eric Wei
> I think the most important thing regarding practicing is to try to get something out of every problem, whether it's a new algorithm or idea, an implementation trick that can help in the future, or just a bug you hopefully won't mess up in the future. That being said, editorials are more useful once you've been stuck for a while; I think the exploration that happens from being a little stuck is often instructive (and good practice for contests, when it's your only option), but at some point the problem's more frustrating than helpful, and sometime before this is probably the right time to take a hint or read the editorial.
I think the most important thing regarding practicing is to try to get something out of every problem, whether it's a new algorithm or idea, an implementation trick that can help in the future, or just a bug you hopefully won't mess up in the future. That being said, editorials are more useful once you've been stuck for a while; I think the exploration that happens from being a little stuck is often instructive (and good practice for contests, when it's your only option). But at some point the problem's more frustrating than helpful, and sometime before this is probably the right time to take a hint or read the editorial.

View file

@ -4,7 +4,7 @@ title: C++ Macros
author: Benjamin Qi
---
Shortening code and making it more (un?)readable.
Shortening code and making it (un?)readable.
<!-- END DESCRIPTION -->

View file

@ -12,7 +12,7 @@ A few reasons why choice of language matters significantly (outside of Bronze).
Although both Python and Java receive two times the C++ time limit in USACO, this is not the case for most other websites (ex. CodeForces). Even with the extended time limits, Python and Java sometimes have trouble passing.
- Rewriting the C++ solution for [USACO Silver Wormsort](http://www.usaco.org/index.php?page=viewproblem2&cpid=992) in Python receives TLE (Time Limit Exceeded) on 2/10 cases.
- Rewriting the C++ solution for [USACO Silver Wormsort](http://www.usaco.org/index.php?page=viewproblem2&cpid=992) in Python receives TLE (Time Limit Exceeded) on 2/10 cases. I'm not sure whether it is possible to pass this problem with Python.
<details>
@ -228,8 +228,8 @@ Although both Python and Java receive two times the C++ time limit in USACO, thi
```
</details>
## Other
## Other Notes
- USACO problemsetters don't always test Java (and rarely Python) solutions when setting constraints.
- Python lacks a data structure that keeps its keys in sorted order (the equivalent of `set` in C++), which is required for some silver problems.
- Java lacks features such as `#define`, `typedef`, and `auto` that are present in C++ (which some contestants rely on extensively, see "macros").
- USACO problemsetters don't always test Java solutions (and rarely Python) when setting constraints. Furthermore it is not guaranteed that there exists a fully working solution in Python.

View file

@ -1,12 +1,14 @@
---
id: ds
title: Data Structures
author: Nathan Wang, Darren Yao, ?
author: Nathan Wang, Darren Yao, Benjamin Qi
order: 5
---
Problems and additional resources regarding built-in data structures.
(clean this up)
<!-- END DESCRIPTION -->
## Problems
@ -17,12 +19,12 @@ Do roughly the first half of the Sorting and Searching section in the [CSES Prob
(actually go through these and check ...)
**Stack:**:
**Stack:**
- UVa 00514 - Rails
- UVa 00732 - Anagram by Stack
- UVa 01062 - Containers
**Queue/Deque:**:
**Queue/Deque:**
- UVa 10172 - The Lonesome Cargo
- UVa 10901 - Ferry Loading III

View file

@ -8,12 +8,12 @@ author: Darren Yao, Benjamin Qi
<!-- END DESCRIPTION -->
Graphs can be used to represent many things, from images to wireless signals, but one of the simplest analogies is to a map. Consider a map with several cities and highways connecting the cities. Some of the problems relating to graphs (which will be covered in Silver) are:
Graphs can be used to represent many things, from images to wireless signals, but one of the simplest analogies is to a map. Consider a map with several cities and highways connecting the cities. Some problems relating to graphsare:
- If we have a map with some cities and roads, what's the shortest distance I have to travel to get from point A to point B?
- Consider a map of cities and roads. Is city A connected to city B? Consider a region to be a group of cities such that each city in the group can reach any other city in said group, but no other cities. How many regions are in this map, and which cities are in which region?
For now, it suffices to learn how graphs are represented.
Both of these will be covered in Silver. For now, it suffices to learn how graphs are represented.
## Tutorial
@ -26,7 +26,7 @@ For now, it suffices to learn how graphs are represented.
- Other
- [Topcoder Graphs Pt 1](https://www.topcoder.com/community/data-science/data-science-tutorials/introduction-to-graphs-and-their-data-structures-section-1/)
## Representing Trees?
## Trees?
## USACO Bronze Problems
@ -37,5 +37,7 @@ For now, it suffices to learn how graphs are represented.
- [Factory](http://usaco.org/index.php?page=viewproblem2&cpid=940)
- [Family Tree](http://usaco.org/index.php?page=viewproblem2&cpid=833)
- [Grass Planting (Silver)](http://usaco.org/index.php?page=viewproblem2&cpid=894)
- Permutation
- [Swapity Swap](http://usaco.org/index.php?page=viewproblem2&cpid=1013)
- General Graph
- [The Great Revegetation](http://usaco.org/index.php?page=viewproblem2&cpid=916)

View file

@ -164,7 +164,7 @@ for(int element : set){
### Ordered Sets
The second type of set data structure is the ordered or sorted set. Insertions, deletions, and searches on the ordered set require O(\log n) time, based on the number of elements in the set. As well as those supported by the unordered set, the ordered set also allows four additional operations: `first`, which returns the lowest element in the set, `last`, which returns the highest element in the set, `lower`, which returns the greatest element strictly less than some element, and `higher`, which returns the least element strictly greater than it.
The second type of set data structure is the ordered or sorted set. Insertions, deletions, and searches on the ordered set require $O(\log n)$ time, based on the number of elements in the set. As well as those supported by the unordered set, the ordered set also allows four additional operations: `first`, which returns the lowest element in the set, `last`, which returns the highest element in the set, `lower`, which returns the greatest element strictly less than some element, and `higher`, which returns the least element strictly greater than it.
```java
TreeSet<Integer> set = new TreeSet<Integer>();

View file

@ -4,22 +4,22 @@ title: "Rectangle Geometry"
author: Darren Yao
---
The extent of "geometry" problems on USACO Bronze are usually quite simple and limited to intersections and unions of squares and rectangles.
"Geometry" problems on USACO Bronze are usually quite simple and limited to intersections and unions of squares or rectangles.
<!-- END DESCRIPTION -->
- They usually only include two or three squares or rectangles, in which case you can simply draw out cases on paper. This should logically lead to a solution.
- Also, the coordinates typically only go up to $1000$, so a program that performs $\approx 1000^2$ operations (ex. with a nested for loop) should pass.
- Some only include two or three squares or rectangles, in which case you can simply draw out cases on paper. This should logically lead to a solution.
- Also, the coordinates typically only go up to $1000$, so a program that performs $\approx 1000^2$ operations (ex. with a nested loop) should pass.
## Problems
- USACO Bronze
- [Fence Painting](http://usaco.org/index.php?page=viewproblem2&cpid=567)
- 1D geometry!!
- [Square Pasture](http://usaco.org/index.php?page=viewproblem2&cpid=663)
- [Blocked Billboard](http://usaco.org/index.php?page=viewproblem2&cpid=759)
- Rectangles
- [Blocked Billboard II](http://usaco.org/index.php?page=viewproblem2&cpid=783)
- Also rectangles
- [Fence Painting](http://usaco.org/index.php?page=viewproblem2&cpid=567)
- 1D geometry!!
- [Square Pasture](http://usaco.org/index.php?page=viewproblem2&cpid=663)
- [Blocked Billboard](http://usaco.org/index.php?page=viewproblem2&cpid=759)
- Rectangles
- [Blocked Billboard II](http://usaco.org/index.php?page=viewproblem2&cpid=783)
- Also rectangles
- Other
- [CF 587 (Div. 3) C: White Sheet](https://codeforces.com/contest/1216/problem/C)

View file

@ -1,19 +1,19 @@
---
id: bitset
title: "Bitset"
id: bitsets
title: "Bitsets"
author: Benjamin Qi
---
Three examples of how bitset leads to some unintended solutions on recent USACO problems.
Three examples of how **bitsets** lead to some unintended solutions on recent USACO problems.
<!-- END DESCRIPTION -->
## Tutorial
tl;dr some operations are 32x-64x faster compared to a boolean array
tl;dr some operations are 32x-64x faster compared to a boolean array.
- [Cpp Reference](http://www.cplusplus.com/reference/bitset/bitset/)
- [Errichto Pt 2](https://codeforces.com/blog/entry/73558)
- [C++ Reference](http://www.cplusplus.com/reference/bitset/bitset/)
- [Errichto Bitwise Operations Pt 2](https://codeforces.com/blog/entry/73558)
## Applications

View file

@ -57,11 +57,11 @@ See [here](https://ioinformatics.org/page/members/7) for additional links. The [
* Misc
* [List of 2017 IOI Participants](http://weaselcrow.com/pro/cf/ioi2017/)
* [IOI 2018 Syllabus](https://people.ksp.sk/~misof/ioi-syllabus/ioi-syllabus.pdf)
* [Baltic OI](http://www.boi2017.org/)
* [CEOI](http://ceoi.inf.elte.hu/)
* [Baltic](http://www.boi2017.org/) (BOI)
* [Central European](http://ceoi.inf.elte.hu/) (CEOI)
* submit BOI / CEOI at [CSES](https://cses.fi/)
* [Balkan OI](http://boi2018.ro/home)
* [IZhO](https://oj.uz/problems/source/24)
* [APIO](http://apio-olympiad.org/)
* [IOIT](http://ioit.altervista.org/2018-teams-and-contests-.html)
* [Balkan](http://boi2018.ro/home)
* [International Zhautykov](https://oj.uz/problems/source/24) (IZhO)
* [Asia-Pacific](http://apio-olympiad.org/) (APIO)
* [International Informatics Olympiad in Teams](http://ioit.altervista.org/2018-teams-and-contests-.html) (IOIT)
* [InfO(1) cup](http://info1cup.com/)

View file

@ -20,6 +20,7 @@ const ModuleOrdering = {
],
"bronze": [
"rect-geo",
"time-comp",
{
name: "Data Structures",
items: [
@ -34,7 +35,6 @@ const ModuleOrdering = {
"intro-graphs",
],
"silver": [
"time-comp",
{
name: "Sorting",
items: [
@ -102,7 +102,7 @@ const ModuleOrdering = {
},
"geo",
"strings",
"bitset",
"bitsets",
"fracture",
]
};