CF793G Oleg and chess

题目描述

**题目翻译:** 有一个 $n×n$ 的矩阵,每行每列至多能放一个棋子,另外有 $q$ 个矩形的区域不能放棋子(这些矩形区域互不相交),问最多能放多少个棋子。$n,q≤10^4$

输入格式

第一行一个正整数 $n≤ 10^4$ 第二行一个正整数 $q≤10^4$ 接下来 $q$ 行,每行$4$个正整数$(x_1,y_1),(x_2,y_2)$,表示矩形的左上角和右下角

输出格式

输出一行表示答案

说明/提示

Here is the board and the example of rooks placement in the first example: ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF793G/151e17be3713c8369d3854433fdb8191260582c2.png)