답안 #2178

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
2178 2013-07-20T07:12:35 Z gs13057 토마토 (KOI13_tomato) C++
8 / 16
1000 ms 9056 KB
#include<cstdio>
int n,m,r;
int d;
int t[1010][1010],tmp[1010][1010];

int main(void){
  int i,j,k;
  int dx[4]={1,-1,0,0},dy[4]={0,0,1,-1};
  scanf("%d%d",&n,&m); r=n*m;
  for(i=0;i<=n+1;i++) t[0][i]=t[m+1][i]=-1;
  for(j=0;j<=m+1;j++) t[j][0]=t[j][n+1]=-1;
  for(i=1;i<=m;i++) for(j=1;j<=n;j++){
    scanf("%d",&t[i][j]);
    if(t[i][j]!=0) r--; }
  for(i=0;i<=m+1;i++) for(j=0;j<=n+1;j++)
    tmp[i][j]=t[i][j];
  while(r>0){ d++;
    for(i=1;i<=m;i++) for(j=1;j<=n;j++)
      if(t[i][j]==1) for(k=0;k<4;k++)
        if(tmp[i+dx[k]][j+dy[k]]==0)
          tmp[i+dx[k]][j+dy[k]]=1,r--;
    for(i=1;i<=m;i++) for(j=1;j<=n;j++) t[i][j]=tmp[i][j];
  }
  printf("%d",d);
  return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 9056 KB Output is correct
2 Correct 0 ms 9056 KB Output is correct
3 Correct 0 ms 9056 KB Output is correct
4 Correct 0 ms 9056 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 9056 KB Output is correct
2 Correct 0 ms 9056 KB Output is correct
3 Execution timed out 1000 ms 9052 KB Program timed out
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 9056 KB Output is correct
2 Correct 12 ms 9056 KB Output is correct
3 Correct 0 ms 9056 KB Output is correct
4 Correct 12 ms 9056 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 9056 KB Output is correct
2 Correct 8 ms 9056 KB Output is correct
3 Correct 0 ms 9056 KB Output is correct
4 Correct 0 ms 9056 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 32 ms 9056 KB Output is correct
2 Correct 0 ms 9056 KB Output is correct
3 Correct 12 ms 9056 KB Output is correct
4 Correct 40 ms 9056 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 9056 KB Output is correct
2 Execution timed out 1000 ms 9052 KB Program timed out
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 712 ms 9056 KB Output is correct
2 Execution timed out 1000 ms 9052 KB Program timed out
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 584 ms 9056 KB Output is correct
2 Correct 352 ms 9056 KB Output is correct
3 Correct 32 ms 9056 KB Output is correct
4 Correct 136 ms 9056 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 596 ms 9056 KB Output is correct
2 Execution timed out 1000 ms 9052 KB Program timed out
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1000 ms 9056 KB Program timed out
2 Halted 0 ms 0 KB -