結果

問題 No.402 最も海から遠い場所
ユーザー jjjj
提出日時 2016-07-22 23:50:27
言語 Fortran
(gFortran 13.2.0)
結果
WA  
実行時間 -
コード長 1,195 bytes
コンパイル時間 1,597 ms
コンパイル使用メモリ 35,992 KB
実行使用メモリ 9,088 KB
最終ジャッジ日時 2024-04-24 06:21:59
合計ジャッジ時間 7,553 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 TLE -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
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(i,j)=string(j:j)
     end do
  end do

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

  print *,map

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

!  check cover all riku in cdist
  do cdist=1, MAX(H,W)
     do i=1,W
        do j=1,H
           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