結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
10,624 KB
testcase_01 AC 1 ms
5,248 KB
testcase_02 AC 2 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 2 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 2 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 3 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 10 ms
5,376 KB
testcase_16 AC 13 ms
5,376 KB
testcase_17 AC 308 ms
23,680 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

  do i=0,W+1
     do j=0,H+1
        if (map(i,j).eq.umi) then
           covered(i,j)=.true.
        else
           covered(i,j)=.false.
        end if
     end do
  end do

!  check cover all riku in cdist
  do cdist=1, MAX(H,W)
     do i=0,W+1
        do j=0,H+1
           if (map(i,j).eq.umi) then
              covered(MIN(i+cdist,W+1),MAX(0,j-cdist):MIN(j+cdist,H+1))=.true.
              covered(MAX(i-cdist,0),  MAX(0,j-cdist):MIN(j+cdist,H+1))=.true.
              covered(MAX(0,i-cdist):MIN(i+cdist,W+1),MIN(j+cdist,H+1))=.true.
              covered(MAX(0,i-cdist):MIN(i+cdist,W+1),MAX(j-cdist,0))  =.true.
           endif
        end do
     end do
     if ( ALL(covered).eqv..true.) then
        print '(i0)',cdist
        exit
     end if
  end do
end program
0