# Divide & Conquer - DP

Authors: Andi Qu, Benjamin Qi

### Prerequisites

Using Divide & Conquer as a DP Optimization.

Allows you to reduce $\mathcal{O}(N^2)$ to $\mathcal{O}(N\log N)$.

## Tutorial

Resources | |||
---|---|---|---|

cp-algo | |||

Jeffrey Xiao | |||

GCP |

## Example - Circular Barn

Focus Problem – read through this problem before continuing!

You should already be familiar with the CHT solution.

### This section is not complete.

Add analysis later.

Check the official editorial.

## Problems

Status | Source | Problem Name | Difficulty | Tags | |||||
---|---|---|---|---|---|---|---|---|---|

CEOI | Normal | ## Show TagsD&C, DP | |||||||

COI | Normal | ## Show TagsD&C, DP | |||||||

CF | Hard | ## Show TagsD&C, DP | |||||||

CF | Hard | ## Show TagsD&C, DP | |||||||

POI | Very Hard | ## Show TagsD&C, DP | |||||||

IOI | Very Hard | ## Show TagsD&C, DP | |||||||

Plat | Very Hard | ## Show TagsD&C, DP | |||||||

JOI | Very Hard | ## Show TagsD&C, DP | |||||||

JOI Bubblesort English Statement: You are given an array of length $N$ $(1 \le N \le 100,000)$. You must choose two numbers in this array and swap them. After swapping these two numbers, you sort the array using a bubble sort algorithm. What is the minimum number of bubble sort swaps necessary, assuming you choose the two initial numbers to swap optimally? The two initial numbers that you swap do not count towards the minimum number of bubble sort swaps.

### 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!