📊
Informatics Notes
  • About
  • About Programming Contests
  • Terminal Setup
  • Editor Setup
  • Debugging
  • Syntax and Templates
    • Scopes 101
    • Quickest IO Library
    • Writing Generic Code (Advanced Bronze)
    • Making a Contest Template
  • USACO Specific
    • Strategy for USACO Bronze
    • Preparing for Contests
    • USACO Division Ladders
    • Division Ladders Answers
  • Binary Lifting (Gold)
    • Binary Lifting (Gold) Intro
    • Binary Lifting (Gold) Part 1
    • Binary Lifting (Gold) Part 2
    • Binary Lifting (Gold) Part 3
  • Graphs (Silver)
  • Sweep Line
    • Sweep Line (Silver-Gold) Intro
    • Sweep Line (Silver-Gold) Part 1
  • Misc Tricks
    • Some C++ Contest Tricks I Wish I Were Told
    • Bitmasking: Generating Subsets Iteratively
    • Difference Arrays (Silver)
    • "Unusing" Identifiers
Powered by GitBook
On this page

Was this helpful?

  1. Sweep Line

Sweep Line (Silver-Gold) Intro

PreviousSweep LineNextSweep Line (Silver-Gold) Part 1

Last updated 3 years ago

Was this helpful?

Sweep line is one of the most useful algorithms to have in your competitive programming toolkit. Unfortunately, not very many good sources exist to learn the approach. Of the ones that do exist, many discuss the approach superficially without examples and concrete implementation in code.

This guide aspires to change that in two parts:

  • 1D Sweep Line

  • 2D Sweep Line (Plane Sweep)

A third part, if created, would discuss more advanced applications, such as sweep line in conjunction with other algorithms, or rotating calipers.

Exposition will be based on the following list of problems (resources inspiring the series are also included afterward); you may wish to go through them on your own time before reading the series itself:

1D Sweep Line:

2D Sweep Line (Plane Sweep):

Written Resources:

Video Tutorials:

(implementation views sweep line as similar to D & C)

(good USACO editorial demonstration)

http://www.usaco.org/index.php?page=viewproblem2&cpid=567
https://cses.fi/problemset/task/1619
http://www.usaco.org/index.php?page=viewproblem2&cpid=786
http://www.usaco.org/index.php?page=viewproblem2&cpid=344
http://www.usaco.org/index.php?page=viewproblem2&cpid=1040
http://www.usaco.org/index.php?page=viewproblem2&cpid=619
http://www.usaco.org/index.php?page=viewproblem2&cpid=227
http://www.usaco.org/index.php?page=viewproblem2&cpid=645
http://www.usaco.org/index.php?page=viewproblem2&cpid=943
https://www.hackerearth.com/practice/math/geometry/line-sweep-technique/tutorial/
https://www.topcoder.com/community/competitive-programming/tutorials/line-sweep-algorithms/
https://codeforces.com/blog/entry/58747
https://codeforces.com/blog/entry/20377
https://courses.csail.mit.edu/6.006/spring11/lectures/lec24.pdf
https://en.wikipedia.org/wiki/Sweep_line_algorithm
https://cses.fi/book/book.pdf#page=173
http://www.usaco.org/current/data/sol_cowjump_silver_open19.html
https://github.com/Aryansh-S/USACO/tree/master/algo%20%26%20ds/SweepLine
https://www.youtube.com/watch?v=bEEbslngvxI
https://www.youtube.com/playlist?list=PLubYOWSl9mItBLmB2WiFU0A_WINUSLtGH