結果

問題 No.409 ダイエット
ユーザー jjjj
提出日時 2016-08-06 00:50:36
言語 Fortran
(gFortran 13.2.0)
結果
WA  
実行時間 -
コード長 631 bytes
コンパイル時間 801 ms
コンパイル使用メモリ 32,384 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-04-24 15:54:14
合計ジャッジ時間 7,193 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
10,624 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 1 ms
5,376 KB
testcase_06 AC 1 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 1 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 1 ms
5,376 KB
testcase_15 AC 1 ms
5,376 KB
testcase_16 WA -
testcase_17 AC 1 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 1 ms
5,376 KB
testcase_20 AC 1 ms
5,376 KB
testcase_21 AC 1 ms
5,376 KB
testcase_22 AC 1 ms
5,376 KB
testcase_23 AC 1 ms
5,376 KB
testcase_24 AC 1 ms
5,376 KB
testcase_25 AC 1 ms
5,376 KB
testcase_26 AC 1 ms
5,376 KB
testcase_27 AC 2 ms
5,376 KB
testcase_28 AC 1 ms
5,376 KB
testcase_29 AC 1 ms
5,376 KB
testcase_30 AC 1 ms
5,376 KB
testcase_31 AC 1 ms
5,376 KB
testcase_32 AC 1 ms
5,376 KB
testcase_33 AC 1 ms
5,376 KB
testcase_34 AC 2 ms
5,376 KB
testcase_35 AC 7 ms
5,376 KB
testcase_36 AC 8 ms
5,376 KB
testcase_37 AC 8 ms
5,376 KB
testcase_38 AC 7 ms
5,376 KB
testcase_39 AC 7 ms
5,376 KB
testcase_40 AC 7 ms
5,376 KB
testcase_41 AC 8 ms
5,376 KB
testcase_42 AC 8 ms
5,376 KB
testcase_43 AC 7 ms
5,376 KB
testcase_44 AC 7 ms
5,376 KB
testcase_45 AC 7 ms
5,376 KB
testcase_46 AC 7 ms
5,376 KB
testcase_47 AC 8 ms
5,376 KB
testcase_48 AC 7 ms
5,376 KB
testcase_49 AC 8 ms
5,376 KB
testcase_50 AC 7 ms
5,376 KB
testcase_51 AC 8 ms
5,376 KB
testcase_52 AC 8 ms
5,376 KB
testcase_53 AC 9 ms
5,376 KB
testcase_54 AC 7 ms
5,376 KB
testcase_55 AC 44 ms
5,376 KB
testcase_56 WA -
testcase_57 AC 87 ms
5,376 KB
testcase_58 AC 38 ms
5,376 KB
testcase_59 WA -
testcase_60 WA -
testcase_61 AC 78 ms
5,376 KB
testcase_62 AC 83 ms
5,376 KB
testcase_63 WA -
testcase_64 WA -
testcase_65 WA -
testcase_66 WA -
testcase_67 WA -
testcase_68 WA -
testcase_69 WA -
testcase_70 TLE -
testcase_71 -- -
testcase_72 -- -
testcase_73 -- -
testcase_74 -- -
testcase_75 -- -
testcase_76 -- -
testcase_77 -- -
testcase_78 -- -
testcase_79 -- -
testcase_80 -- -
testcase_81 -- -
testcase_82 -- -
testcase_83 -- -
testcase_84 -- -
testcase_85 -- -
testcase_86 -- -
testcase_87 -- -
testcase_88 -- -
testcase_89 -- -
testcase_90 -- -
testcase_91 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

program main
  implicit none
  integer*8::N,A,B,W,i,str,str_max,tmp,uplimit
  integer*8,allocatable::D(:)
  integer*8,allocatable::dp(:)

  read *, N,A,B,W
  allocate(D(N))
  allocate(dp(0:N))
  read *, D

  dp(0) = W

  dp(1) = W - A + B*1
  dp(0) = W + D(1)
  str_max = 1

  do i=2,N
     tmp = MINVAL(dp(0:str_max)) + D(i)
     if(tmp.eq.dp(0)) then
        !tabeta houga kanarazu yoi
        str_max = 0
     end if

     !str ha tamesugi nai
     do str=str_max+1,1,-1
        dp(str) = dp(str-1) - A + B*str
     end do
     dp(0) = tmp
     str_max = str_max + 1
  end do

  print '(i0)', MINVAL(dp(0:str_max))

end program
0