結果

問題 No.250 atetubouのzetubou
ユーザー jjjj
提出日時 2016-08-06 20:27:13
言語 Fortran
(gFortran 13.2.0)
結果
TLE  
実行時間 -
コード長 1,002 bytes
コンパイル時間 2,003 ms
コンパイル使用メモリ 31,960 KB
実行使用メモリ 20,716 KB
最終ジャッジ日時 2024-04-24 19:26:56
合計ジャッジ時間 52,456 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3,168 ms
20,352 KB
testcase_01 AC 2,087 ms
20,096 KB
testcase_02 AC 4,551 ms
20,484 KB
testcase_03 AC 4,768 ms
20,652 KB
testcase_04 AC 4,691 ms
20,716 KB
testcase_05 AC 4,230 ms
20,480 KB
testcase_06 AC 1,758 ms
20,376 KB
testcase_07 AC 2,794 ms
20,468 KB
testcase_08 AC 4,006 ms
20,352 KB
testcase_09 AC 3,184 ms
20,352 KB
testcase_10 TLE -
testcase_11 AC 2,835 ms
20,408 KB
testcase_12 AC 2,915 ms
20,412 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

recursive function solve(X, D,  memo) result(res)
  integer*8::res, D,X,memo(1500,1500)
  if(memo(X,D).eq.0_8) then
     memo(X,D) = solve(X,D-1,memo) + solve(X-1, D, memo)
  end if
  !  print '("X:",i5,", D:",i5,", memo:",i5)',X,D,memo(X,D)
  res = memo(X,D)
  if(res.gt.10**15_8) then
     memo(X:1500,D:1500)=10**15_8
  end if
  return
end function solve

program main
  implicit none
  type problem
     integer*8::D,X,T
  end type problem
  interface
     recursive function solve(X, D, memo) result(res)
       integer*8::res, D,X,memo(1500,1500)
     end function solve
  end interface

  integer*8::Q,i,j,k,tmp
  integer*8::qd,qx,qt
  type(problem)::P(10**4)
  integer*8::D,T,memo(1500,1500) !X,D
  data memo/2250000*0/

  read *, Q
  read *, P(1:Q)

  do i=1,1500
     memo(1,i) = i
  end do
  memo(:,1) = 1

  do i=1,Q
     tmp = solve(P(i)%X, P(i)%D, memo)
     if(tmp.gt.P(i)%T) then
        print '(a)', "ZETUBOU"
     else
        print '(a)', "AC"
     end if
  end do

end program main
0