#include <iostream>
#include <fstream>
#include <list>
using namespace std ;
//#define N 17
ifstream infile ("el.txt"); //Input file
ofstream outfile("matrix.txt"); //Output file
int main (){
int a, b;
int n;
infile >> n ;
int** matrix = new int*[n];
for (int i = 0; i < n; ++i)
matrix[i] = new int[n];
while (infile >> a && a!=-1){
infile >> b;
matrix[a-1][b-1] = 1;
matrix[b-1][a-1] = 1;
}
for (int i=0; i<n; i++){
for (int j=0; j<n; j++){
if (matrix[i][j] == 1)
outfile << " 1 " << " " ;
else
outfile << " 9 " << " " ;
}
outfile << endl ;
}
for (int i = 0; i < n; ++i)
delete [] matrix[i];
delete [] matrix;
return 0;
}
your text goes here
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8ZnN0cmVhbT4KI2luY2x1ZGUgPGxpc3Q+CnVzaW5nIG5hbWVzcGFjZSBzdGQgOwoKLy8jZGVmaW5lIE4gMTcKCmlmc3RyZWFtIGluZmlsZSAoImVsLnR4dCIpOyAgICAgLy9JbnB1dCBmaWxlCm9mc3RyZWFtIG91dGZpbGUoIm1hdHJpeC50eHQiKTsgICAgIC8vT3V0cHV0IGZpbGUKCgoKaW50IG1haW4gKCl7CglpbnQgYSwgYjsKCWludCBuOwoKCWluZmlsZSA+PiBuIDsKCglpbnQqKiBtYXRyaXggPSBuZXcgaW50KltuXTsKCWZvciAoaW50IGkgPSAwOyBpIDwgbjsgKytpKQoJICAgIG1hdHJpeFtpXSA9IG5ldyBpbnRbbl07CgoKCXdoaWxlIChpbmZpbGUgPj4gYSAmJiBhIT0tMSl7CgkJaW5maWxlID4+IGI7CgkJbWF0cml4W2EtMV1bYi0xXSA9IDE7CgkJbWF0cml4W2ItMV1bYS0xXSA9IDE7Cgl9CgoJZm9yIChpbnQgaT0wOyBpPG47IGkrKyl7CgkJZm9yIChpbnQgaj0wOyBqPG47IGorKyl7CgkJCWlmIChtYXRyaXhbaV1bal0gPT0gMSkKCQkJCW91dGZpbGUgPDwgIiAxICIgPDwgIiAiIDsKCQkJZWxzZQoJCQkJb3V0ZmlsZSA8PCAiIDkgIiA8PCAiICIgOwoJCX0KCQlvdXRmaWxlIDw8IGVuZGwgOwoJfQoKCWZvciAoaW50IGkgPSAwOyBpIDwgbjsgKytpKQogIAkJZGVsZXRlIFtdIG1hdHJpeFtpXTsKCWRlbGV0ZSBbXSBtYXRyaXg7CgoJcmV0dXJuIDA7Cn0KeW91ciB0ZXh0IGdvZXMgaGVyZQ==