Last active
August 29, 2015 14:21
-
-
Save OmarJH/82125a4c247454f2175b to your computer and use it in GitHub Desktop.
Board HakerRank
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
using namespace std; | |
int main() | |
{ | |
char m; | |
int xs, ys,n1,n2,tx,ty,coun=0; | |
vector < vector <int> > a; | |
cin >> xs >> ys; | |
a.resize(xs); | |
for (int i = 0; i < xs; i++) | |
a[i].resize(ys); | |
cin >> n1; | |
for (int i = 0; i < n1; i++) | |
{ | |
cin >> tx; | |
cin >> m; | |
cin >> ty; | |
a[tx][ty] = 1; | |
} | |
cin >> n2; | |
for (int i = 0; i < n2; i++) | |
{ | |
cin >> tx; | |
cin >> m; | |
cin >> ty; | |
for (int j = 0; j < ys; j++) | |
a[tx][j] = 0; | |
for (int j = 0; j < xs; j++) | |
a[j][ty] = 0; | |
} | |
for (int i = 0; i < xs; i++) | |
{ | |
for (int j = 0; j < ys; j++) | |
{ | |
if (a[i][j] == 1) | |
coun++; | |
} | |
} | |
cout << coun << endl; | |
//cin >> coun; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment