#include <stdio.h>
#define fin "graphcoloring.in"
#define SIZE 50
int main(int argc, char const *argv[]) {
int i, j, n, ok;
int matrix[SIZE][SIZE];
//freopen(fin, "r", stdin);
//read the number of the countries
int arr_colors[n+1],
color;
//read the relation between countries
for(i = 0; i < n; ++i) {
for(j = 0; j < n; ++j) {
scanf("%d", &matrix
[i
][j
]);
}
}
//display the relation between countries
for(i = 0; i < n; ++i) {
for(j = 0; j < n; ++j) {
}
}
arr_colors[ 0 ] = 0;
for( i = 1; i < n; ++i ) {
color = -1;
do {
ok = 1;
color++;
for(j = 0; j < i; ++j)
if(matrix[j][i] == 1 && arr_colors[j] == color)
ok = 0;
}
while(!ok);
arr_colors[i] = color;
}
for(i
= 0; i
< n
; ++i
) printf("%d ", arr_colors
[i
]+1);
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNkZWZpbmUgZmluICJncmFwaGNvbG9yaW5nLmluIgojZGVmaW5lIFNJWkUgNTAKCmludCBtYWluKGludCBhcmdjLCBjaGFyIGNvbnN0ICphcmd2W10pIHsKCiAgaW50IGksIGosIG4sIG9rOwogIGludCBtYXRyaXhbU0laRV1bU0laRV07CiAgLy9mcmVvcGVuKGZpbiwgInIiLCBzdGRpbik7CgogIC8vcmVhZCB0aGUgbnVtYmVyIG9mIHRoZSBjb3VudHJpZXMKICBzY2FuZigiJWQiLCAmbik7CiAgaW50IGFycl9jb2xvcnNbbisxXSwKICAgICAgY29sb3I7CgogIC8vcmVhZCB0aGUgcmVsYXRpb24gYmV0d2VlbiBjb3VudHJpZXMKICBmb3IoaSA9IDA7IGkgPCBuOyArK2kpIHsKCiAgICBmb3IoaiA9IDA7IGogPCBuOyArK2opIHsKCiAgICAgIHNjYW5mKCIlZCIsICZtYXRyaXhbaV1bal0pOwoKICAgIH0KICB9CgogICAvL2Rpc3BsYXkgdGhlIHJlbGF0aW9uIGJldHdlZW4gY291bnRyaWVzCiAgZm9yKGkgPSAwOyBpIDwgbjsgKytpKSB7CgogICAgZm9yKGogPSAwOyBqIDwgbjsgKytqKSB7CgogICAgICBwcmludGYoIiVkICIsIG1hdHJpeFtpXVtqXSk7CiAgICB9CiAgICBwcmludGYoIlxuIik7CiAgfQoKICBhcnJfY29sb3JzWyAwIF0gPSAwOwoKICBmb3IoIGkgPSAxOyBpIDwgbjsgKytpICkgewoKICAgICAgY29sb3IgPSAtMTsKCiAgICAgICAgZG8gewogICAgICAgICBvayA9IDE7CiAgICAgICAgIGNvbG9yKys7CiAgICAgICAgIGZvcihqID0gMDsgaiA8IGk7ICsraikKICAgICAgICAgICAgIGlmKG1hdHJpeFtqXVtpXSA9PSAxICYmIGFycl9jb2xvcnNbal0gPT0gY29sb3IpCiAgICAgICAgICAgICAgICBvayA9IDA7CiAgICAgICAgfQoKICAgICAgICB3aGlsZSghb2spOwoKICAgICAgICBhcnJfY29sb3JzW2ldID0gY29sb3I7CiAgfQoKICBwcmludGYoImNvbG9yczpcbiIpOwoKICBmb3IoaSA9IDA7IGkgPCBuOyArK2kpIHByaW50ZigiJWQgIiwgYXJyX2NvbG9yc1tpXSsxKTsKCiAgcHJpbnRmKCJcbiIpOwoKICByZXR1cm4gMDsKfQo=