結果
問題 |
No.4 おもりと天秤
|
ユーザー |
![]() |
提出日時 | 2016-07-23 19:42:38 |
言語 | Fortran (gFortran 14.2.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 619 bytes |
コンパイル時間 | 1,435 ms |
コンパイル使用メモリ | 32,384 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-06 15:22:48 |
合計ジャッジ時間 | 3,534 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 14 RE * 9 |
ソースコード
program main implicit none integer::N,total,i,j, total_weight integer::W(100) integer::dp_memo(0:5000,1:100) data dp_memo/500100*0/ read *, N, W(1:N) total = SUM(W(1:N)) if(MOD(total,2).eq.1) then print '(a)','impossible' return end if do i=N,1,-1 do j=0,total/2 if(j.lt.W(i)) then dp_memo(j,i) = dp_memo(j, i+1) else dp_memo(j,i) = MAX(dp_memo(j,i+1),dp_memo(j-W(i), i+1)+W(i)) endif end do end do if(dp_memo(total/2, 1).eq.total/2) then print '(a)','possible' else print '(a)','impossible' end if end program main