Please subscribe to the official Codeforces channel in Telegram via the link https://t.me/codeforces_official. ×

rahul_107's blog

By rahul_107, 3 months ago, In English
### Question:
There is a grid with a balloon at some cells. Players can shoot arrows from outside the grid horizontally and vertically. Every arrow shot will burst all balloons in that row if fired horizontally and in that column if fired vertically.
Given the positions of the balloons in the grid find the minimum no of arrows required to burst all the balloons.

### Constraints:
1 <= N(No of ballons) <= 50
0 <= x, y -> Positions of the balloons < 10^9-1

### Input Format:
Line1: Integer denoting N.
Next N lines, where each of the ith lines contains two integers representing (row, col) of ith balloon.

### Sample Input :
6
15 21
33 8
17 21
17 8
28 11
28 19

### Sample Output:
3

### Sample Input :
6
15 1
15 2
15 3
15 4
18 1
20 1

### Sample Output:
2

Read more »

 
 
 
 
  • Vote: I like it
  • +12
  • Vote: I do not like it