knightnemo commited on
Commit
1420b6c
·
verified ·
1 Parent(s): c67e509

Upload code_segments/segment_213.txt with huggingface_hub

Browse files
Files changed (1) hide show
  1. code_segments/segment_213.txt +18 -0
code_segments/segment_213.txt ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ You have $n$ rectangles, the $i$-th of which has a width of $a_i$ and a height of $b_i$.
2
+
3
+ You can perform the following operation an unlimited number of times: choose a rectangle and a cell in it, and then color it.
4
+
5
+ Each time you completely color any row or column, you earn $1$ point. Your task is to score at least $k$ points with as few operations as possible.
6
+
7
+ Suppose you have a rectangle with a width of $6$ and a height of $3$. You can score $4$ points by coloring all the cells in any $4$ columns, thus performing $12$ operations.
8
+
9
+ The first line contains an integer $t$ ($1 \le t \le 100$) — the number of test cases. The following are the descriptions of the test cases.
10
+
11
+ The first line of each test case description contains two integers $n$ and $k$ ($1 \le n \le 1000, 1 \le k \le 100$) — the number of rectangles in the case and the required number of points.
12
+
13
+ The next $n$ lines contain the descriptions of the rectangles. The $i$-th line contains two integers $a_i$ and $b_i$ ($1 \le a_i, b_i \le 100$) — the width and height of the $i$-th rectangle.
14
+
15
+ It is guaranteed that the sum of the values of $n$ across all test cases does not exceed $1000$.
16
+
17
+ For each test case, output a single integer — the minimum number of operations required to score at least $k$ points. If it is impossible to score at least $k$ points, output -1.
18
+