#include <stdio.h>
int existe(int vet[], int tamanho, int valor){
int i;
for (i = 0; i < tamanho; ++i){
if (vet[i] == valor){
return 1;
}
}
return 0;
}
int main () {
int l, c, i, j, mat[10][10], vet[100], unicos=0;
if (l <= 0 || l > 10 || c <= 0 || c > 10){
printf("dimensao invalida\n"); }
else {
for (i=0; i<l; i++){
for (j=0; j<c; j++){
}
}
for (i = 0; i < l; i++) {
for (j = 0; j < c; j++) {
if (!existe(vet, unicos, mat[i][j])){
vet[unicos++] = mat[i][j];
}
}
}
}
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgZXhpc3RlKGludCB2ZXRbXSwgaW50IHRhbWFuaG8sIGludCB2YWxvcil7CiAgICBpbnQgaTsKICAgIGZvciAoaSA9IDA7IGkgPCB0YW1hbmhvOyArK2kpewogICAgICAgIGlmICh2ZXRbaV0gPT0gdmFsb3IpewogICAgICAgICAgICByZXR1cm4gMTsKICAgICAgICB9CiAgICB9CiAgICByZXR1cm4gMDsKfQoKaW50IG1haW4gKCkgewoJaW50IGwsIGMsIGksIGosIG1hdFsxMF1bMTBdLCB2ZXRbMTAwXSwgdW5pY29zPTA7CgoJc2NhbmYgKCIlZCAlZCIsJmwsJmMpOwoJaWYgKGwgPD0gMCB8fCBsID4gMTAgfHwgYyA8PSAwIHx8IGMgPiAxMCl7CgkJcHJpbnRmKCJkaW1lbnNhbyBpbnZhbGlkYVxuIik7Cgl9CgllbHNlIHsKCQlmb3IgKGk9MDsgaTxsOyBpKyspewoJCQlmb3IgKGo9MDsgajxjOyBqKyspewoJCQkJc2NhbmYoIiVkIiwmbWF0W2ldW2pdKTsKCQkJfQoJCX0KCgkJZm9yIChpID0gMDsgaSA8IGw7IGkrKykgewoJCQlmb3IgKGogPSAwOyBqIDwgYzsgaisrKSB7CiAgICAgICAgICAgICAgICBpZiAoIWV4aXN0ZSh2ZXQsIHVuaWNvcywgbWF0W2ldW2pdKSl7CiAgICAgICAgICAgICAgICAgICAgdmV0W3VuaWNvcysrXSA9IG1hdFtpXVtqXTsKICAgICAgICAgICAgICAgIH0KCQkJfQoJCX0KCQlwcmludGYoIiVkIiwgdW5pY29zKTsKCX0KCXJldHVybiAwOwp9Cg==