結果

問題 No.92 逃走経路
ユーザー jjjj
提出日時 2016-07-30 05:41:13
言語 Fortran
(gFortran 13.2.0)
結果
WA  
実行時間 -
コード長 1,148 bytes
コンパイル時間 258 ms
コンパイル使用メモリ 34,904 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-24 12:24:58
合計ジャッジ時間 1,234 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

program main
  integer*8::N,M,K,i,j,l,src,dest
  integer*8,allocatable::road(:,:)
  integer*8,allocatable::list(:,:)
  integer*8,allocatable::keiro(:)
  integer*8,allocatable::han1(:),han2(:)
  integer*8::ryoukin, num, tmp

  read *,N,M,K
  allocate(road(3,M))
  allocate(list(N,N))
  allocate(keiro(K))
  allocate(han1(N))
  allocate(han2(N))
  read *, road
  read *, keiro


  han1 = 1
  han2 = 0
  list(:,0) = 0

  do i=1,N
     src  = road(1,i)
     dest = road(2,i)
     list(src, 0) = list(src, 0) + 1
     list(src, list(src, 0)) = dest
     list(dest, 0) = list(dest, 0) + 1
     list(dest, list(dest, 0)) = src
  end do

  do i=1, K
     ryoukin = keiro(i)
     do j=1, N
        if(han1(j).eq.1) then
           tmp = list(j,0)
           do l=1, tmp
              han2(list(j,l)) = 1
           end do
        end if
     end do
     han1 = han2
     han2 = 0
  end do

  num = SUM(han1)
  print '(i0)', num
  do i=1,N
     if(han1(i).eq.1) then
        num = num - 1
        if(num.ne.0) then
           write(6,'(i0,a)',advance='no') i, " "
        else
           write(6,'(i0)') i
        end if
     end if
  end do
end program main
0