#include <stdio.h>
#include <stdlib.h>
//必要があれば変数などを追加してもOKです
int main(){
int i,j,k=1;
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;
}
}
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+CiNpbmNsdWRlIDxzdGRsaWIuaD4KCi8v5b+F6KaB44GM44GC44KM44Gw5aSJ5pWw44Gq44Gp44KS6L+95Yqg44GX44Gm44KCT0vjgafjgZkKCmludCBtYWluKCl7CiAgICBpbnQgaSxqLGs9MTsKICAgIGludCBhLGI7CiAgICBpbnQgKiptYXQ7CiAgICBzY2FuZigiJWQgJWQiLCZhLCZiKTsKCiAgIG1hdCA9IChpbnQgKiopbWFsbG9jKGEgKiBzaXplb2YoaW50ICopKTsKICAgIGlmIChtYXQgPT0gTlVMTCkgewogICAgICAgIHByaW50Zigi44Oh44Oi44Oq5Ymy44KK5b2T44Gm44Gr5aSx5pWX44GX44G+44GX44GfXG4iKTsKICAgICAgICByZXR1cm4gMTsKICAgIH0KICAgIGZvciAoaSA9IDA7IGkgPCBhOyBpKyspIHsKICAgICAgICBtYXRbaV0gPSAoaW50ICopbWFsbG9jKGIgKiBzaXplb2YoaW50KSk7CiAgICAgICAgaWYgKG1hdFtpXSA9PSBOVUxMKSB7CiAgICAgICAgICAgIHByaW50Zigi44Oh44Oi44Oq5Ymy44KK5b2T44Gm44Gr5aSx5pWX44GX44G+44GX44GfXG4iKTsKICAgICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgfQogICAgfQogZm9yKGk9MDtpPGE7aSsrKXsKICAgICAgICBmb3Ioaj0wO2o8YjtqKyspewogICAgICAgICAgICBtYXRbaV1bal09aysrOwogICAgICAgIH0KICAgCiAgICB9CiAgICAKICAgIGZvcihpPTA7aTxhO2krKyl7CiAgICAgICAgZm9yKGo9MDtqPGI7aisrKXsKICAgICAgICAgICAgcHJpbnRmKCIlZCAiLG1hdFtpXVtqXSk7CiAgICAgICAgfQogICAgICAgIHByaW50ZigiXG4iKTsKICAgIH0KICAgIAogICAgZnJlZShtYXQpOwoKCiAgICByZXR1cm4gMDsKfQo=