#include <stdio.h>
#include <stdlib.h>
int main() {
int i, j,k;
int a, b;
int **mat;
mat
= (int **)malloc(a
* sizeof(int *)); if (mat == NULL) {
return 1;
}
for (i = 0; i < a; i++) {
mat
[i
] = (int *)malloc(b
* sizeof(int)); if (mat[i] == NULL) {
return 1;
}
}
k= 1;
for (i = 0; i < a; i++) {
for (j = 0; j < b; j++) {
mat[i][j] = k++;
}
}
for (i = 0; i < a; i++) {
for (j = 0; j < b; j++) {
}
}
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KCmludCBtYWluKCkgewogICAgaW50IGksIGosazsKICAgIGludCBhLCBiOwogICAgaW50ICoqbWF0OwoKICAgIHNjYW5mKCIlZCAlZCIsICZhLCAmYik7CgogICAgbWF0ID0gKGludCAqKiltYWxsb2MoYSAqIHNpemVvZihpbnQgKikpOwogICAgaWYgKG1hdCA9PSBOVUxMKSB7CiAgICAgICAgcHJpbnRmKCLjg6Hjg6Ljg6rjga7norrkv53jgavlpLHmlZfjgZfjgb7jgZfjgZ9cbiIpOwogICAgICAgIHJldHVybiAxOwogICAgfQoKICAgIGZvciAoaSA9IDA7IGkgPCBhOyBpKyspIHsKICAgICAgICBtYXRbaV0gPSAoaW50ICopbWFsbG9jKGIgKiBzaXplb2YoaW50KSk7CiAgICAgICAgaWYgKG1hdFtpXSA9PSBOVUxMKSB7CiAgICAgICAgICAgIHByaW50Zigi44Oh44Oi44Oq44Gu56K65L+d44Gr5aSx5pWX44GX44G+44GX44GfXG4iKTsKICAgICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgfQogICAgfQoKICAgIGs9IDE7CiAgICBmb3IgKGkgPSAwOyBpIDwgYTsgaSsrKSB7CiAgICAgICAgZm9yIChqID0gMDsgaiA8IGI7IGorKykgewogICAgICAgICAgICBtYXRbaV1bal0gPSBrKys7CiAgICAgICAgfQogICAgfQoKICAgIGZvciAoaSA9IDA7IGkgPCBhOyBpKyspIHsKICAgICAgICBmb3IgKGogPSAwOyBqIDwgYjsgaisrKSB7CiAgICAgICAgICAgIHByaW50ZigiJWQgIiwgbWF0W2ldW2pdKTsKICAgICAgICB9CiAgICAgICAgcHJpbnRmKCJcbiIpOwogICAgfQoKICAgIGZyZWUobWF0KTsKCiAgICByZXR1cm4gMDsKfQo=