CF793G Oleg and chess

题目描述

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

输入格式

输出格式

说明/提示

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)