結果

問題 No.402 最も海から遠い場所
ユーザー jj
提出日時 2016-07-23 04:40:32
言語 Fortran
(gFortran 14.2.0)
結果
TLE  
実行時間 -
コード長 1,286 bytes
コンパイル時間 812 ms
コンパイル使用メモリ 33,920 KB
実行使用メモリ 19,432 KB
最終ジャッジ日時 2024-11-06 14:26:29
合計ジャッジ時間 6,411 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15 TLE * 1 -- * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

subroutine create_map(map,H,W)
  implicit none
  logical,parameter::riku=.true.,umi=.false.
  character*3000::string
  integer(kind=4)::H,W,i,j
  logical,allocatable::map(:,:)

  read *,H,W

  allocate(map(0:W+1,0:H+1))

  do i=1,H
     read *, string
     do j=1,W
        if(string(j:j)=='.') then
           map(j,i)=umi
        else
           map(j,i)=riku
        end if
     end do
  end do
  map(0  ,:)  =umi
  map(W+1,:)  =umi
  map(:  ,0)  =umi
  map(:,H+1)  =umi

end subroutine create_map

program main
  implicit none
  interface
     subroutine create_map(map,H,W)
       logical,allocatable::map(:,:)
       integer::H,W
     end subroutine create_map
  end interface
  integer(kind=4)::H,W
  logical,allocatable::map(:,:)
  logical,parameter::riku=.true.,umi=.false.
  integer,allocatable::dist_h(:),dist_w(:)
  integer::i,j,k,l,max_dist=1,dist

  call create_map(map,H,W)

  do dist=1,MIN(H,W)
     do i=dist,W-dist+1
        do j=dist,H-dist+1
           if(map(i,j).eqv.riku) then
              if(ALL(ALL(map(i-dist:i+dist,j-dist:j+dist),1))) then
                 max_dist=dist+1
                 goto 100
              end if
           end if
        end do
     end do

     goto 200
100  continue
  end do
200 continue

  print '(i0)',max_dist
end program main
0