GithubHelp home page GithubHelp logo

bqi343 / cp-notebook Goto Github PK

View Code? Open in Web Editor NEW
2.3K 81.0 412.0 21.96 MB

General Resources for Competitive Programming

License: Creative Commons Zero v1.0 Universal

C++ 75.10% Java 9.38% TeX 2.07% Batchfile 0.01% Shell 0.15% JavaScript 0.40% Makefile 0.05% C 9.67% Python 2.87% Kotlin 0.29% Vim Script 0.01%
usaco codeforces programming-contests competitive-programming algorithm data-structure

cp-notebook's Introduction

README

Some material has been moved to the USACO Guide.

Notes

I am not planning to update:

  • READMEs for most implementations
  • USACO problem tables and solutions
    • Tables for recent USACO problems can be found here.

Since I frequently move stuff around, some READMEs may refer to files which no longer exist. If you would like to contribute, provide feedback, or encourage me to update something, please email me at [email protected] or submit a pull request. If you have a question, please read the entirety of "Resources" -> "Questions.md" first.

cp-notebook's People

Contributors

becauseiknownothing avatar bqi343 avatar dcclyde avatar dolphingarlic avatar dongliu0426 avatar franklynwang avatar itzsomebody avatar nocrizwang avatar rqi3 avatar senpat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cp-notebook's Issues

DirectedMST reconstruction crashes

With https://github.com/bqi343/USACO/blob/master/Implementations/content/graphs%20(12)/Misc/DirectedMST.h,

int main() {
	int n = 4, r = 1;
	vector<tuple<int, int, int>> data = {
		{0, 3, 27},
		{1, 2, 32},
		{2, 3, 25},
		{3, 0, 31},
		{3, 2, 23},
	};
	vector<Edge> edges;
	trav(e, data) {
		int a = get<0>(e);
		int b = get<1>(e);
		int w = get<2>(e);
		edges.push_back({a, b, w});
	}

	dmst(n, r, edges);
}

ends up with inEdge.s == -1 in the restore loop, causing it to misbehave and in practice later hit this assert: assert(i == r ? in[i].s == -1 : in[i].s == i);.

Found while looking into importing it into KACTL, through the directed MST stress test: https://github.com/kth-competitive-programming/kactl/blob/master/stress-tests/graph/DirectedMST.cpp. I don't understand the restoration algorithm well enough to know how to patch it.

Review Implementations

Probably worth maintaining a list of implementations included in the notebook here but not in KACTL. Check the corresponding implementation if:

  • title is informative
  • usage is clear
  • impl has been validated
  • distracting comments don't appear in the notebook
  • impl has been compared against KACTL

Both:

  • AhoCorasickFixed
  • ModIntShort
  • ModFact
  • OrderStatisticTree
  • Segment Tree
  • Matrix
    • TODO: probably not worth including + and - in the notebook?
  • LazySegmentTree
    • note: kactl's version is dynamic
  • ModSqrt
  • (uncommon) gp_hash_table
    • TODO: shorten the version here?
  • linecontainer (old)
    • TODO: compare vs KACTL, compare vs new version?
  • modmulll
  • fastmod
  • MillerRabin
  • FactorFast
  • Python3
  • Simplex
  • Integrate
  • IntegrateAdaptive
  • DSU
  • RMQ
  • LinearRecurrence
    • TODO: check if I actually remember what this does
  • LCAjump
  • treap
  • Polynomial
  • PolyInterpolate
  • GaussianElimination
  • FFT
  • FFTMod
    • TODO: make this compatible with ModInt
  • ModSum
  • Euclid
  • FracInterval
  • CRT
  • MinCostMaxFlow
    • TODO: recheck this
  • GomoryHu
    • TODO: check that this works with Dinic
  • MaxMatchFast
    • TODO: Usage / Indexing
  • Hungarian
    • TODO: Usage / Indexing
  • EulerWalk
    • TODO: Usage / Indexing
  • SCCT
    • TODO: Usage / Indexing
  • TwoSAT
    • TODO: Usage / Indexing
  • BCC
    • TODO: Usage / Indexing
  • MaximalCliques
  • HLD
  • LinkCutTree
  • DirectedMST
  • MatrixTree
  • PointShort
    • OnSegment
  • SegDist
  • SegIsect
  • Circle
  • CircleIsect
  • CircleTangents
  • Circumcenter
  • MinEnclosingCirc
  • EdgeColor
  • DelaunayFast
  • PolyhedronVolume
  • Point3D
  • FastIO
  • KMP
  • Z
  • PolyCenArea
  • PolySaVol
  • Manacher
  • SuffixArray
  • (Rare) SuffixTree
  • HashRange
  • LCArmq
  • AngleCmp
  • InPolygon
  • Bellman Ford / Negative Cycle
  • ConvexHull (Monotone Chain)
  • HullDiameter
  • LineHull
  • CircleTangents
  • ClosestPair
  • PolygonArea
  • PolygonCenter

Here Only:

  • simple sieve
  • persistent segment tree
  • Multiplicative Prefix
    • TODO: remember what this does
  • PrimeCnt
  • ModArith
  • DeBruijnSeq
  • Nim Product
    • TODO: Usage
  • matroid intersection
    • TODO: Usage
  • ShermanMorrison
    • TODO: Usage
  • polynomial inverse / log / exp
    • TODO: clean up
    • what's the difference between exp and expOld?
  • Centroid Decomp
  • Dinic
  • GeneralMatchBlossom
  • GeneralWeightedMatch
    • is the time complexity actually $O(N^3)$?
  • ChordalGraphRecognition
  • DominatorTree
  • ComplexComp
  • HalfPlaneIsect
  • DelaunayIncremental
  • Delaunay3
    • TODO: remove versions of Delaunay that are not preferred
  • ManhattanMST
  • Point3D
  • Hull3DFast
  • SuffixArrayLinear
    • TODO: check how fast this really is
  • PalindromicTree
  • (Rare) LyndonFactor
  • (Rare) ReverseBurrowsWheeler
  • (Rare) TandemRepeats
  • (Rare) SuffixAutomaton
  • (Rare) CircularLCS
  • (Rare) SMAWK

KACTL Only:

  • ContinuedFractions
  • FracBinarySearch
  • minRotation
  • (unused) Angle
  • (unused) sideOf
  • (unused) PolygonCut
  • (unused) PointInsideHull
  • (unused) LineHullIntersection
  • (easy) BIT
  • (easy) union find rollback
  • (easy) 2D rectangle sums
  • (easy) BIT2D
  • (easy) MoQueries
  • (easy) PolyRoots
  • (easy) golden section search
  • (easy) hill climbing
  • (unused) IntDeterminant
  • (easy) SolveLinearBinary
  • (never used) Tridiagonal
  • (easy) fast subset transform
  • (easy) modlog
  • (never used) FastEratosthenes
  • (easy) PhiFunction
  • (unused) IntPerm
  • (easy) Multinomial
  • (easy) floyd warshall
  • (easy) TopoSort
  • (rarely used) PushRelabel
  • (slow) EdmondsKarp
  • (easy) DFS matching
  • (easy) MinimumVertexCover
  • (easy) CompressTree
  • (easy) linearTransformation
  • (unused) CirclePolyIntersection
  • (easy) IntervalContainer
  • (easy) IntervalCover
  • (easy) ConstantIntervals
  • (easy) Ternary Search
  • (easy) LIS
  • (slow) Hull3DSlow
  • (unused) BumpAllocator
  • (unused) SIMD
  • (unused) KdTree
  • (unused) Spherical Distance
  • (unused) GlobalMinCut
  • (unused) General Matching - Matrix Version
  • (unused) MaximumClique

Hi

Hi Benjamin Congratulations for placing first in IOI. Can you share some of your templates and reading list? I really want to each plat this year in USACO.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.