Submission #172734


Source Code Expand

Copy
#include<stdio.h>
#include<stdlib.h>
#ifndef max
#define max(a,b) (a) > (b) ? (a) : (b)
#endif
#define INF -9999999
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("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(k=1;k<d;k++)a[i][j][k]=0;
	}
	maxT(d,0,0);
	printf("%hd\n",maxP);
	return 0;
}
	

Submission Info

Submission Time
Task B - 謎の人物X
User toj210
Language C (GCC 4.6.4)
Score 0
Code Size 868 Byte
Status CE

Compile Error

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