Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- ifstream fin("adiacenta.in");
- ofstream fout("adiacenta.out");
- int ma[100][100] = {0}, x, y, n, m;
- int main()
- {
- fin >> n >> m;
- for (int p=1; p<=m; p++)
- {
- fin >> x >> y;
- ma[x][y] = ma[y][x] = 1;
- }
- for (int i=1; i<=n; i++)
- {
- for (int j=1; j<=n; j++)
- {
- fout << ma[i][j] << " ";
- }
- fout << endl;
- }
- fin.close();
- fout.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment