Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- using namespace std;
- /**
- se dau 2 grafuri neorientate prin lista muchiilor in 2 fisiere.
- stabiliti daca cele doua grafuri sunt identice
- (acelasi nr de vf si ac muchii)
- */
- ifstream fin("graf1.in");
- ifstream fin1("graf2.in");
- //ofstream fout("reuniune.out");
- //ofstream fout1("intersectie.out");
- /// 4/175 manulal
- int n1, n2;
- int a[101][101], b[101][101];
- int main()
- {
- fin>>n1; fin1>>n2;
- if(n1!=n2) {cout<<"NU"; return 0;}
- int x, y;
- while(fin>>x>>y) a[x][y] = a[y][x] = 1;
- while(fin1>>x>>y) b[x][y] = b[y][x] = 1;
- for(int i=1;i<=n;++i)
- for(int j=1;j<=n;++j)
- if(a[i][j] != b[i][j])
- {
- cout<<"NU";
- return 0;
- }
- cout<<"DA";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement