結果

問題 No.402 最も海から遠い場所
ユーザー jjjj
提出日時 2016-07-23 02:10:37
言語 Fortran
(gFortran 13.2.0)
結果
TLE  
実行時間 -
コード長 1,364 bytes
コンパイル時間 291 ms
コンパイル使用メモリ 35,712 KB
実行使用メモリ 77,824 KB
最終ジャッジ日時 2024-04-24 07:06:00
合計ジャッジ時間 5,747 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
10,624 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 10 ms
5,376 KB
testcase_16 AC 15 ms
5,376 KB
testcase_17 AC 292 ms
36,352 KB
testcase_18 TLE -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

  integer(kind=4)::H,W
  logical,allocatable::map(:,:)
  logical,parameter::riku=.true.,umi=.false.
  integer,allocatable::rcdist(:,:)
  character*3000::string
  integer::i,j,k,max_cdist

  read *,H,W

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

  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,    0:H+1) =umi
  map(W+1,  0:H+1) =umi
  map(0:W+1,    0) =umi
  map(0:W+1,  H+1) =umi
  rcdist(1:W,1:H)=0

  do i=1,W
     do j=1,H
        if (map(i,j).eqv.umi) then
           continue
        end if

        do k=1,MIN(MIN(W+1-i,i),MIN(H+1-j,j))
           if     (ANY(map(i+k,j-k:j+k).eqv.umi)) then
              rcdist(i,j)=k
              exit
           else if(ANY(map(i-k,j-k:j+k).eqv.umi)) then
              rcdist(i,j)=k
              exit
           else if(ANY(map(i-k+1:i+k-1,j+k).eqv.umi)) then
              rcdist(i,j)=k
              exit
           else if(ANY(map(i-k+1:i+k-1,j-k).eqv.umi)) then
              rcdist(i,j)=k
              exit
           end if
        end do

     end do
  end do

  max_cdist=0
  do i=1,W
     do j=1,H
        if(map(i,j).eqv.riku) then
           max_cdist=MAX(max_cdist, rcdist(i,j))
        end if
     end do
  end do
  print '(i0)',max_cdist
end program
0