結果
| 問題 | No.409 ダイエット |
| コンテスト | |
| ユーザー |
jj
|
| 提出日時 | 2016-08-06 00:50:36 |
| 言語 | Fortran (gFortran 16.1.0) |
| 結果 |
WA
不安定
|
| 実行時間 | - |
| コード長 | 631 bytes |
| 記録 | |
| コンパイル時間 | 1,539 ms |
| コンパイル使用メモリ | 41,124 KB |
| 実行使用メモリ | 10,048 KB |
| 最終ジャッジ日時 | 2026-09-19 21:30:31 |
| 合計ジャッジ時間 | 11,388 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 59 WA * 11 TLE * 1 -- * 21 |
ソースコード
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
jj