Contest Duration: - (local time) (90 minutes) Back to Home

Submission #172973

Source Code Expand

Copy
```#include<stdio.h>
#include<stdlib.h>
#ifndef max
#define max(a,b) (a) > (b) ? (a) : (b)
#endif
#define INF -9999999
//even or odd
void swap(int *a,int *b){
int *tmp;
tmp=a;
a=b;
b=tmp;
}
short int a[1024][1024][512];
int r,c,i,j,maxP=INF;

int maxT(int n,int p,int q){
if(n==0){
if(maxP<a[p][q][n]){
maxP=a[p][q][n];
a[p][q][n]=maxP;
//printf("hoge-1,p=%d,q=%d,n=%d\n",p,q,n);
//printf("maxP=%d\n",maxP);
}
return a[p][q][n];
}
if(a[p][q][n]>0)return a[p][q][n];
else{
if(p-1>=0)a[p-1][q][n-1]=maxT(n-1,p-1,q);
if(q-1>=0)a[p][q-1][n-1]=maxT(n-1,p,q-1);
if(p+1<r)a[p+1][q][n-1]=maxT(n-1,p+1,q);
if(q+1<c)a[p][q+1][n-1]=maxT(n-1,p,q+1);
}
}

int main(){
int d,k,total;
scanf("%d %d %d",&r,&c,&d);
for(i=0;i<r;i++)for(j=0;j<c;j++)scanf("%hd",&a[i][j][0]);
for(i=0;i<r;i++)for(j=0;j<c;j++)for(k=1;k<d;k++)a[i][j][k]=0;
maxT(d,0,0);
printf("%hd\n",maxP);
return 0;
}
```

#### Submission Info

Submission Time 2014-05-19 04:39:52+0900 B - 謎の人物X toj210 C (GCC 4.6.4) 0 950 Byte CE

#### Compile Error

```./Main.c: In function ‘main’:
./Main.c:38:7: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
./Main.c:39:39: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
collect2: ld terminated with signal 9 [Killed]
```