CandyRush SOLUTIONS SC_03 CODECHEF

CandyRush SOLUTIONS SC_03 CODECHEF

Problem Statement

All of you more likely than not played the game treats squash. So here is a bomb which works a lot of the organic product bomb in treats squash. A creator, Anton, planned an exceptionally incredible bomb. The bomb, when put on an area (x,y) in a R×C network, clears out the line x and section y totally. 
 
You are given a R×C lattice with N targets. You have just one bomb. Your point is to amplify the harm and subsequently devastate generally number of targets. Given the area of focuses on the network, discover the quantity of focuses on that can devastated. 
 
The lattice framework utilizes record beginning with 0. 
 
Info 
 
First line contains three space isolated numbers, R, C and N. At that point, N lines follow. 
 
Each line contains space isolated whole numbers r and c referencing the area of the objective. 
 
Yield 
 
A solitary whole number giving the quantity of focuses on that can be crushed. 
 
Requirements 
 
1≤R,C≤3×105 
 
1≤N≤min(R×C,3×105) 
 
0≤r<R 
 
0≤c<C 
 
Any information pair (r,c) isn’t rehashed. 
 
Subtasks 
 
The all out imprints will be separated into: 
 
20% : R,C≤103 
 
80% : Original Constraints 
 
Test Input 
 
2 3 
 
 
 
0 2 
 
Test Output 
 
 
Clarification 
 
It is conceivable to pulverize all the objectives in the event that we place the bomb at (0,1). Henceforth, complete number of targets devastated is 3, which is our answer.
 

Leave a Comment

close
error: Content is protected !!