fork download
  1. static long solve(int idx, int s, int p, int t, int a[], int b[]) {
  2. if (idx == a.length) {
  3. return 0;
  4. }
  5. if (dp[idx][s] == -1) {
  6. if (a[idx] > b[idx]) {
  7. if (p > 0) {
  8. dp[idx][s] = a[idx] + solve(idx + 1, s, p - 1, t, a, b);
  9. } else {
  10. dp[idx][s] = b[idx] + solve(idx + 1, s, p, t - 1, a, b);
  11. }
  12. } else {
  13. if (t > 0) {
  14. dp[idx][s] = b[idx] + solve(idx + 1, s, p, t - 1, a, b);
  15. } else {
  16. dp[idx][s] = a[idx] + solve(idx + 1, s, p - 1, t, a, b);
  17. }
  18. }
  19. }
  20. return dp[idx][s];
  21. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:1: error: class, interface, or enum expected
static long solve(int idx, int s, int p, int t, int a[], int b[]) {
       ^
Main.java:4: error: class, interface, or enum expected
        }
        ^
Main.java:9: error: class, interface, or enum expected
                } else {
                ^
Main.java:11: error: class, interface, or enum expected
                }
                ^
Main.java:15: error: class, interface, or enum expected
                } else {
                ^
Main.java:17: error: class, interface, or enum expected
                }
                ^
Main.java:21: error: class, interface, or enum expected
    }
    ^
7 errors
stdout
Standard output is empty