advanced stuff
This commit is contained in:
parent
4b9f134fbd
commit
cfc7891f99
16 changed files with 267 additions and 5 deletions
10
content/6_Plat/Aliens.mdx
Normal file
10
content/6_Plat/Aliens.mdx
Normal file
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
id: aliens
|
||||
title: "Aliens Trick"
|
||||
author: Benjamin Qi
|
||||
description: "?"
|
||||
prerequisites:
|
||||
- Plat - Convex Hull
|
||||
---
|
||||
|
||||
IOI 2016 Aliens
|
|
@ -14,7 +14,8 @@ export const metadata = {
|
|||
problems: {
|
||||
general: [
|
||||
new Problem("CSES", "Hamiltonian Flights", "1690", "Easy", false, ["Bitmasks"], ""),
|
||||
new Problem("CSES", "Elevator Rides", "1653", "Normal", false, ["LCA"], ""),
|
||||
new Problem("CSES", "Elevator Rides", "1653", "Normal", false, ["Bitmasks"], ""),
|
||||
new Problem("YS", "Max Indep Set", "maximum_independent_set", "Hard", false, ["Bitmasks", "Meet in Middle"], ""),
|
||||
],
|
||||
}
|
||||
};
|
||||
|
|
36
content/6_Plat/Euler.mdx
Normal file
36
content/6_Plat/Euler.mdx
Normal file
|
@ -0,0 +1,36 @@
|
|||
---
|
||||
id: eulers-formula
|
||||
title: "Euler's Formula"
|
||||
author: Benjamin Qi
|
||||
description: "?"
|
||||
prerequisites:
|
||||
- "?"
|
||||
---
|
||||
|
||||
import { Problem } from "../models";
|
||||
|
||||
export const metadata = {
|
||||
problems: {
|
||||
e1: [
|
||||
new Problem("DMOJ", "Rainbow Gold", "apio17p1", "Hard", false, [],""),
|
||||
],
|
||||
e2: [
|
||||
new Problem("Plat", "Valleys", "950", "Hard", false, [], ""),
|
||||
],
|
||||
other: [
|
||||
new Problem("Kattis", "Island Archipelago", "https://utipc20s.kattis.com/problems/utipc20s.islandarchipelago", "Very Hard", false, [],""),
|
||||
],
|
||||
}
|
||||
};
|
||||
|
||||
## Example 1
|
||||
|
||||
<problems-list problems={metadata.problems.e1} />
|
||||
|
||||
Land of Rainbow Gold
|
||||
|
||||
## Example 2
|
||||
|
||||
<problems-list problems={metadata.problems.e2} />
|
||||
|
||||
<problems-list problems={metadata.problems.other} />
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
id: flows
|
||||
id: max-flow
|
||||
title: "Maximum Flow"
|
||||
author: Benjamin Qi
|
||||
prerequisites:
|
||||
|
@ -47,3 +47,10 @@ Has not been the solution to any platinum problem, but appeared in old gold.
|
|||
- [Incorrect Flow](https://codeforces.com/contest/708/problem/D)
|
||||
- [Multi-Path Story](https://atcoder.jp/contests/jag2013summer-day4/tasks/icpc2013summer_day4_i)
|
||||
- [WAC 4 - Hungry Squirrels](https://dmoj.ca/problem/wac4p6)
|
||||
|
||||
|
||||
* Faster Max Flow
|
||||
* Hopcroft-Karp Bipartite Matching
|
||||
* Dinic's Algorithm
|
||||
* Push-Relabel
|
||||
* [Fast Flow Implementation - Chilli](https://codeforces.com/blog/entry/66006)
|
|
@ -33,3 +33,9 @@ prerequisites:
|
|||
- Generalization of "Balance Beam"
|
||||
|
||||
Minkowski addition?
|
||||
|
||||
## With DP
|
||||
|
||||
cbarn
|
||||
|
||||
mowing
|
|
@ -35,3 +35,5 @@ description: Knuth-Morris-Pratt and Z Algorithms (and a few more related topics)
|
|||
- Tutorial
|
||||
- [adamant](http://codeforces.com/blog/entry/14854)
|
||||
- [GeeksForGeeks](http://www.geeksforgeeks.org/aho-corasick-algorithm-pattern-searching/)
|
||||
|
||||
## Palindromic Tree (Intro)
|
13
content/7_Advanced/BBST.mdx
Normal file
13
content/7_Advanced/BBST.mdx
Normal file
|
@ -0,0 +1,13 @@
|
|||
(likely restricted to camp)
|
||||
|
||||
* Treap
|
||||
* Notes
|
||||
* [Quora](https://threads-iiith.quora.com/Treaps-One-Tree-to-Rule-em-all-Part-1)
|
||||
* [PPT](https://docs.google.com/presentation/d/14xgtdDWnIBwmJRAuIdZ8FvLZcX9uRxnNoGOGAQRDIvc/edit?usp=sharing)
|
||||
* Samuel Hsiang Guide (see resources)
|
||||
* [Euler Tour Tree](https://codeforces.com/blog/entry/18369)
|
||||
* Problems
|
||||
* [Strings](https://csacademy.com/contest/archive/task/strings/) [](181)
|
||||
* [Points & Distances](https://www.hackerearth.com/problem/algorithm/septembereasy-points-and-distances-d30d0e6b/description/) [](185)
|
||||
* [Tree Rotations 2](https://szkopul.edu.pl/problemset/problem/b0BM0al2crQBt6zovEtJfOc6/site/?key=statement) [](193)
|
||||
* [A2OJ](https://a2oj.com/category?ID=14)
|
18
content/7_Advanced/Game_Theory.mdx
Normal file
18
content/7_Advanced/Game_Theory.mdx
Normal file
|
@ -0,0 +1,18 @@
|
|||
|
||||
* Game Theory
|
||||
* Tutorial
|
||||
* [HackerRank](https://www.hackerrank.com/topics/game-theory-and-grundy-numbers)
|
||||
* [TopCoder](https://www.topcoder.com/community/data-science/data-science-tutorials/algorithm-games/)
|
||||
* Books (thanks mnbvmar!)
|
||||
* "On Numbers and Games" - Conway
|
||||
* "Winning Ways for Your Mathematical Plays" (Berlekamp, Conway, Guy)
|
||||
* Topics
|
||||
* Nim
|
||||
* Grundy Numbers
|
||||
* Sprague-Grundy Theorem
|
||||
* Problem(s)
|
||||
* [Division Game](https://uva.onlinejudge.org/index.php?option=onlinejudge&page=show_problem&problem=2959)
|
||||
* [Game of Stones](http://codeforces.com/problemset/problem/768/E) [](59)
|
||||
* [Factorization Game](https://www.hackerearth.com/problem/algorithm/mancunian-and-factorization-game-b8794702/) [](61)
|
||||
* [Arpa & Game](http://codeforces.com/contest/850/problem/C) [](66)
|
||||
* [Apple Tree](http://codeforces.com/contest/812/problem/E) [](67)
|
44
content/7_Advanced/LCT.mdx
Normal file
44
content/7_Advanced/LCT.mdx
Normal file
|
@ -0,0 +1,44 @@
|
|||
(restricted to camp)
|
||||
|
||||
* Splay Tree
|
||||
* Notes
|
||||
* [Splay Tree Paper](https://www.cs.cmu.edu/~sleator/papers/self-adjusting.pdf)
|
||||
* [Splay Tree Presentation](https://web.stanford.edu/class/archive/cs/cs166/cs166.1146/lectures/08/Slides08.pdf)
|
||||
* Link Cut Tree
|
||||
* Notes
|
||||
* [Link-Cut Tree](http://courses.csail.mit.edu/6.851/spring12/scribe/L19.pdf)
|
||||
* [CTSC 2014 Translation](https://www.overleaf.com/read/zbbwngftkrkx?fbclid=IwAR1VJmGscfSZJHejVqU5_2Nlm8-R09pFlU7PpEg_i3CXEd0Qw-dzliSn5RI)
|
||||
* [Subtree Queries Tutorial](https://codeforces.com/blog/entry/67637)
|
||||
* Problems
|
||||
* SPOJ
|
||||
* [DYNACON1](https://www.spoj.com/problems/DYNACON1/)
|
||||
* technically, LCT isn't needed because the queries are offline
|
||||
* [DYNALCA](https://www.spoj.com/problems/DYNALCA/)
|
||||
* CF
|
||||
* [Silence's Sounds](https://codeforces.com/contest/1109/problem/F)
|
||||
* test connectivity
|
||||
* [Train Tracking](https://codeforces.com/contest/1344/problem/E)
|
||||
* switching can be done with LCT access
|
||||
* set min on path with lazy prop
|
||||
* [Solution](https://codeforces.com/contest/1344/submission/79212522)
|
||||
* [Tree or not Tree](https://codeforces.com/contest/117/problem/E)
|
||||
* tree + one edge
|
||||
* [Old Driver Tree](https://codeforces.com/contest/1172/problem/E)
|
||||
* [Pastoral Oddities](https://codeforces.com/contest/603/problem/E)
|
||||
* path + subtree queries
|
||||
* USACO Camp (not public)
|
||||
* [The Applicant](https://probgate.org/viewproblem.php?pid=578)
|
||||
* tree + one edge
|
||||
* [Cows Play on a Tree](https://probgate.org/viewproblem.php?pid=259)
|
||||
* reverse tree paths
|
||||
* HLD + Treap
|
||||
* or two LCTs, one for real tree labels and one for query labels
|
||||
* Other
|
||||
* [Balanced Tokens (Eric Zhang)](https://www.hackerrank.com/contests/pwshpc-online-round/challenges/pwsh-tokens/problem)
|
||||
* [Dynamic Tree Test (Easy)](https://dmoj.ca/problem/ds5easy)
|
||||
* [Dynamic Tree Test](https://dmoj.ca/problem/ds5)
|
||||
* Requires operations on subtrees in addition to those from the easy version
|
||||
* [CEOI Treasure Hunt](https://cses.fi/174/list/)
|
||||
* get k-th parent
|
||||
* [CERC 17 D](https://codeforces.com/gym/101620)
|
||||
* LCT not needed, but can directly apply solution from "The Applicant"
|
31
content/7_Advanced/Matroid_Isect.mdx
Normal file
31
content/7_Advanced/Matroid_Isect.mdx
Normal file
|
@ -0,0 +1,31 @@
|
|||
|
||||
* Matroid Intersection
|
||||
* Tutorial
|
||||
* [CF Tutorial](https://codeforces.com/blog/entry/69287)
|
||||
* [Parametrized Algorithms Ch 12](http://parameterized-algorithms.mimuw.edu.pl/parameterized-algorithms.pdf)
|
||||
* [Illinois Lecture Notes](https://courses.engr.illinois.edu/cs598csc/sp2010/Lectures/Lecture17.pdf)
|
||||
* [Goemans](https://math.mit.edu/~goemans/18438F09/lec13.pdf)
|
||||
* describes partition matroid
|
||||
* Problems
|
||||
* [Honesty](https://www.urionlinejudge.com.br/judge/en/problems/view/2128)
|
||||
* Max Size Graphic + Colorful
|
||||
* [Coins](https://www.spoj.com/problems/COIN/)
|
||||
* Max Size Graphic + Colorful
|
||||
* [SERVERS](https://www.codechef.com/problems/SERVERS)
|
||||
* Max Size Graphic + Colorful
|
||||
* [Seollal](https://codeforces.com/contest/1284/problem/G)
|
||||
* Max Size Graphic + Colorful
|
||||
* [Pick Your Own Nim](https://codeforces.com/gym/102156/problem/D)
|
||||
* Max Size Linear + Colorful
|
||||
* [CCNCT2](https://www.codechef.com/problems/CNNCT2)
|
||||
* Max Size Graphic + Graphic
|
||||
* [Ambiguous Forest](https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=3080)
|
||||
* Max Size Graphic + Graphic
|
||||
* [Rainbow Graph](https://open.kattis.com/problems/rainbowgraph)
|
||||
* Min Weight Graphic + Colorful
|
||||
* [NAIPC 2018 Sols](http://serjudging.vanb.org/?p=1165)
|
||||
* [Arup Guha Sol](http://www.cs.ucf.edu/~dmarino/progcontests/mysols/northamerica/2018/g.java)
|
||||
* [HAMEL](https://www.codechef.com/problems/HAMEL)
|
||||
* Partition into 2 MST's, then construct
|
||||
* [TST](https://dmoj.ca/problem/dmopc19c3p6)
|
||||
* Partition into 3 MST's
|
9
content/7_Advanced/MinCostFlow.mdx
Normal file
9
content/7_Advanced/MinCostFlow.mdx
Normal file
|
@ -0,0 +1,9 @@
|
|||
|
||||
* Minimum Cost Flow
|
||||
* Tutorial
|
||||
* [TopCoder](https://www.topcoder.com/community/data-science/data-science-tutorials/minimum-cost-flow-part-two-algorithms/)
|
||||
* [Johnson's Algorithm](https://en.wikipedia.org/wiki/Johnson%27s_algorithm)
|
||||
* Problems
|
||||
* [April Fool's Problem](http://codeforces.com/contest/802/problem/N)
|
||||
* [Cow & Exercise](https://codeforces.com/contest/1307/problem/G)
|
||||
* consider LP dual
|
60
content/7_Advanced/Multiplicative.mdx
Normal file
60
content/7_Advanced/Multiplicative.mdx
Normal file
|
@ -0,0 +1,60 @@
|
|||
---
|
||||
id: multiplicative
|
||||
title: "Summing Multiplicative Functions"
|
||||
author: Benjamin Qi
|
||||
description: ?
|
||||
---
|
||||
|
||||
(doesn't appear on USACO)
|
||||
|
||||
https://codeforces.com/blog/entry/54150
|
||||
|
||||
## Counting Primes
|
||||
|
||||
https://judge.yosupo.jp/problem/counting_primes
|
||||
|
||||
## Totient Function
|
||||
|
||||
https://judge.yosupo.jp/problem/sum_of_totient_function
|
||||
|
||||
```cpp
|
||||
template<int SZ> struct Sieve {
|
||||
vi pr;
|
||||
int sp[SZ], phi[SZ]; // smallest prime that divides
|
||||
Sieve() { // above is faster
|
||||
memset(sp,0,sizeof sp);
|
||||
phi[1] = 1;
|
||||
FOR(i,2,SZ) {
|
||||
if (sp[i] == 0) {
|
||||
sp[i] = i, pr.pb(i); phi[i] = i-1;
|
||||
} trav(p,pr) {
|
||||
if (p > sp[i] || i*p >= SZ) break;
|
||||
sp[i*p] = p;
|
||||
phi[i*p] = (p == sp[i] ? p : p-1)*phi[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const int HI = 5000000;
|
||||
Sieve<HI> S;
|
||||
ll N;
|
||||
vmi small(HI), big;
|
||||
|
||||
int main() {
|
||||
setIO(); re(N); big.rsz(N/HI+2);
|
||||
FOR(i,1,HI) small[i] = small[i-1]+S.phi[i];
|
||||
ROF(i,1,sz(big)) {
|
||||
ll mx = N/i; big[i] = mi(mx)*(mx+1)/2; // dbg("HUH",i,big[i]);
|
||||
for (ll fac = 2, nex; fac <= mx; fac = nex) {
|
||||
ll quo = mx/fac; nex = mx/quo+1;
|
||||
big[i] -= (nex-fac)*(quo < HI ? small[quo] : big[i*fac]);
|
||||
}
|
||||
}
|
||||
ps(big[1]);
|
||||
}
|
||||
```
|
||||
|
||||
(project euler)
|
||||
|
||||
(topcoder problem)
|
12
content/7_Advanced/Persistent.mdx
Normal file
12
content/7_Advanced/Persistent.mdx
Normal file
|
@ -0,0 +1,12 @@
|
|||
(likely restricted to camp)
|
||||
|
||||
* Persistent Segment Tree
|
||||
* Tutorial
|
||||
* [Anudeep2011](https://blog.anudeep2011.com/persistent-segment-trees-explained-with-spoj-problems/)
|
||||
* [oml1111](https://drive.google.com/file/d/0BwGLW04WRv0ITEZjRWlMSFc2bk0/view)
|
||||
* [Lazy Propogation](http://codeforces.com/blog/entry/47108?#comment-315047)
|
||||
* Problems
|
||||
* [A2OJ](https://a2oj.com/category?ID=651)
|
||||
|
||||
|
||||
(WAC problem)
|
12
content/7_Advanced/String_Suffix.mdx
Normal file
12
content/7_Advanced/String_Suffix.mdx
Normal file
|
@ -0,0 +1,12 @@
|
|||
(restricted to camp)
|
||||
|
||||
* String Suffix Structures
|
||||
* [Suffix Automata](http://codeforces.com/blog/entry/20861)
|
||||
* Suffix Tree
|
||||
* [CF](http://codeforces.com/blog/entry/16780)
|
||||
* [CP-Algo](https://cp-algorithms.com/string/suffix-tree-ukkonen.html)
|
||||
* O(nlogn) suffix array usually suffices
|
||||
* [Palindromic Tree](http://codeforces.com/blog/entry/13959)
|
||||
* [Palindrome Partition](https://codeforces.com/contest/932/problem/G)
|
||||
* [Partial Solution](https://codeforces.com/blog/entry/19193)
|
||||
* [Palindromic Magic (HARD)](https://codeforces.com/contest/1081/problem/H)
|
|
@ -122,7 +122,6 @@ const ModuleOrdering = {
|
|||
items: [
|
||||
"dp-bitmasks",
|
||||
"dp-ranges",
|
||||
"slope",
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -131,7 +130,8 @@ const ModuleOrdering = {
|
|||
"sp-neg",
|
||||
"more-dfs",
|
||||
"eulerian-tours",
|
||||
"flows",
|
||||
"euler",
|
||||
"max-flow",
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -148,11 +148,12 @@ const ModuleOrdering = {
|
|||
"geo-pri",
|
||||
"hull",
|
||||
"LC",
|
||||
"aliens",
|
||||
"slope",
|
||||
]
|
||||
},
|
||||
"bitsets",
|
||||
"fracture",
|
||||
"fft",
|
||||
]
|
||||
};
|
||||
|
||||
|
|
Reference in a new issue