forked from sachin-bisht/dynamic-programming
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gridland.cpp
37 lines (33 loc) · 780 Bytes
/
gridland.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int rows,columns,tracks;
cin >> rows >> columns >> tracks;
int arr[rows][columns] = {0} , row1, column1, column2;
for(int i = 1; i <= tracks; i++)
{
cin >> row1 >> column1 >> column2;
while(column1 <= column2)
{
arr[row1][column1] = 10909;
column1++;
}
}
int counter = 0;
for(int i = 1; i <= rows; i++)
{
for(int j = 1; j <= columns; j++)
{
if(arr[i][j] != 10909)
{
counter++;
}
}
}
cout << counter;
return 0;
}