답안 #1182

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1182 2013-06-29T11:59:05 Z hgp744 토마토 (3차원) (KOI13_tomato3D) C
0 / 20
0 ms 8592 KB
#include<stdio.h>

int d[1000][1000];
int z[1000][1000];
int main()
{
    int g,s,c,i,j,cc=1,ff,fff;
    freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
    scanf("%d %d %d",&g,&s,&c);
    for(i=1; i<=s*c; i++){
             for(j=1; j<=g; j++){
                      scanf("%d",&d[i][j]);
             }
    }
   while(1){
             for(i=1; i<=s*c; i++){
                      for(j=1; j<=g; j++){
                               if(d[i][j]==cc){
                                               if(i-s>0 && d[i-s][j]==0) d[i-s][j]=cc+1;
                                               if(d[i+s][j]==0) d[i+s][j]=cc+1;
                                               if(d[i][j+1]==0) d[i][j+1]=cc+1;
                                               if(d[i][j-1]==0) d[i][j-1]=cc+1;
                                               if(d[i+1][j]==0) d[i+1][j]=cc+1;
                                               if(d[i-1][j]==0) d[i-1][j]=cc+1;
                               }
                      }
             }
             cc++;
             ff=0;
             fff=1;
             for(i=1; i<=s*c; i++){
                      for(j=1; j<=g; j++){
                               if(d[i][j]==0) ff=1;
                               if(z[i][j]==d[i][j] && fff==1) fff=1;
                               else fff=0;
                               z[i][j]=d[i][j];
                      }
             }
             if(fff==1){ printf("-1"); return 0; }
             if(ff==0) break;
    }   
    printf("%d",cc-1);
 
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 8592 KB close (syscall #3) was called by the program (disallowed syscall)
2 Halted 0 ms 0 KB -
3 Halted 0 ms 0 KB -
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 8592 KB close (syscall #3) was called by the program (disallowed syscall)
2 Halted 0 ms 0 KB -
3 Halted 0 ms 0 KB -
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 8592 KB close (syscall #3) was called by the program (disallowed syscall)
2 Halted 0 ms 0 KB -
3 Halted 0 ms 0 KB -
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 8592 KB close (syscall #3) was called by the program (disallowed syscall)
2 Halted 0 ms 0 KB -
3 Halted 0 ms 0 KB -
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 8592 KB close (syscall #3) was called by the program (disallowed syscall)
2 Halted 0 ms 0 KB -
3 Halted 0 ms 0 KB -
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 8592 KB close (syscall #3) was called by the program (disallowed syscall)
2 Halted 0 ms 0 KB -
3 Halted 0 ms 0 KB -
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 8592 KB close (syscall #3) was called by the program (disallowed syscall)
2 Halted 0 ms 0 KB -
3 Halted 0 ms 0 KB -
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 8592 KB close (syscall #3) was called by the program (disallowed syscall)
2 Halted 0 ms 0 KB -
3 Halted 0 ms 0 KB -
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 8592 KB close (syscall #3) was called by the program (disallowed syscall)
2 Halted 0 ms 0 KB -
3 Halted 0 ms 0 KB -
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 8592 KB close (syscall #3) was called by the program (disallowed syscall)
2 Halted 0 ms 0 KB -
3 Halted 0 ms 0 KB -
4 Halted 0 ms 0 KB -