結果

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

テストケース

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

ソースコード

diff #

  integer(kind=2)::H,W
  character,allocatable::map(:,:)
  character,parameter::riku='#',umi='.'
  logical,allocatable::covered(:,:)
  character*3000::string
  integer::cdist

  read *,H,W
  allocate(map(0:W+1,0:H+1))
  allocate(covered(0:W+1,0:H+1))

  do i=1,H
     read *, string
     do j=1,W
        map(j,i)=string(j:j)
     end do
  end do

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

  cdist=1
  do i=1,W
     do j=1,H
        if(map(i,j).eq.riku) then
           do l=1,MAX(H,W)
              if(ANY(map(MIN(i+l,W+1),MAX(0,j-l):MIN(j+l,H+1)).eq.umi) .or. &
                 ANY(map(MAX(i-l,0),  MAX(0,j-l):MIN(j+l,H+1)).eq.umi) .or. &
                 ANY(map(MAX(0,i-l):MIN(i+l,W+1),MIN(j+l,H+1)).eq.umi) .or. &
                 ANY(map(MAX(0,i-l):MIN(i+l,W+1),MAX(j-l,0))  .eq.umi) ) then
                 cdist = MAX(cdist,l)
                 exit
              end if
           end do
        end if
     end do
  end do
  print '(i0)',cdist
end program
0