結果

問題 No.402 最も海から遠い場所
ユーザー jjjj
提出日時 2016-07-23 01:49:29
言語 Fortran
(gFortran 13.2.0)
結果
RE  
実行時間 -
コード長 1,268 bytes
コンパイル時間 530 ms
コンパイル使用メモリ 35,756 KB
実行使用メモリ 52,888 KB
最終ジャッジ日時 2024-04-24 07:05:30
合計ジャッジ時間 5,914 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
10,752 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 1 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 1 ms
5,376 KB
testcase_15 AC 8 ms
5,376 KB
testcase_16 AC 11 ms
5,376 KB
testcase_17 RE -
testcase_18 TLE -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

  integer(kind=4)::H,W
  character,allocatable::map(:,:)
  character,parameter::riku='#',umi='.'
  integer,allocatable::rcdist(:,:)
  character*3000::string
  integer::cdist,min_cdist,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
        map(i,j)=string(j:j)
     end do
  end do

  map(0,:)  =umi
  map(W+1,:)=umi
  map(:,0)  =umi
  map(:,H+1)=umi


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

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