結果

問題 No.92 逃走経路
ユーザー jjjj
提出日時 2016-07-30 04:47:47
言語 Fortran
(gFortran 13.2.0)
結果
AC  
実行時間 81 ms / 5,000 ms
コード長 1,021 bytes
コンパイル時間 222 ms
コンパイル使用メモリ 34,328 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-24 12:24:47
合計ジャッジ時間 1,287 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

  integer*8::N,M,K,i,j,l
  integer*8,allocatable::road(:,:)
  integer*8,allocatable::keiro(:)
  integer*8,allocatable::han1(:),han2(:)
  integer*8::ryoukin, num
  read *,N,M,K
  allocate(road(3,M))
  allocate(keiro(K))
  allocate(han1(N))
  allocate(han2(N))
  read *, road
  read *, keiro

  han1 = 1
  han2 = 0

  do i=1, K
     ryoukin = keiro(i)
     do j=1, N
        if(han1(j).eq.1) then
           do l=1,M
              if(road(3,l).eq.ryoukin) then
                 if(road(1,l).eq.j) then
                    han2(road(2,l)) = 1
                 else if(road(2,l).eq.j) then
                    han2(road(1,l)) = 1
                 end if
              end if
           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
0