結果
問題 | No.37 遊園地のアトラクション |
ユーザー | kou6839 |
提出日時 | 2014-12-09 15:38:24 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 849 bytes |
コンパイル時間 | 2,921 ms |
コンパイル使用メモリ | 73,824 KB |
実行使用メモリ | 58,740 KB |
最終ジャッジ日時 | 2023-09-02 12:10:18 |
合計ジャッジ時間 | 8,676 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | AC | 140 ms
55,716 KB |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | AC | 140 ms
55,932 KB |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | AC | 138 ms
55,496 KB |
testcase_25 | AC | 139 ms
55,796 KB |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | AC | 143 ms
55,712 KB |
testcase_29 | WA | - |
testcase_30 | AC | 145 ms
55,832 KB |
ソースコード
import java.math.*; import java.util.*; public class Main { static int dfs(int now){ if(dp[now]!=0) return dp[now]; int res=0; for(int i=0;i<n;i++){ if(now-c[i]<0) continue; kai[i]++; res=Math.max(res,dfs(now-c[i])+(int)(v[i]/Math.pow(2,kai[i]-1))); kai[i]--; } return dp[now]=res; } static int[] kai; static int n; static int[] c; static int[] v; static int[] dp; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t=sc.nextInt(); n = sc.nextInt(); dp=new int[t+1]; c=new int[n]; kai=new int[n]; v=new int[n]; for(int i=0;i<n;i++){ c[i]=sc.nextInt(); } for(int i=0;i<n;i++){ v[i]=sc.nextInt(); } System.out.println(dfs(t)); } }