// Errichto - easy
public static double minTime(int[] x, int[] y) {
int n = x.length;
int M = 1 << n;
double dp[][] = new double[M][n];
for(int S = 0; S < M; ++S)
for(int A = 0; A < M; ++A)
if((S | A) == S)
for(int a = 0; a < n; ++a)
for(int b = 0; b < n; ++b)
if((A & (1 << a)) > 0)
if((S & (1 << b)) > 0 && (A & (1 << b)) == 0) {
double dist
= Math.
sqrt(Math.
pow(x
[a
]-x
[b
],
2) + Math.
pow(y
[a
]-y
[b
],
2)); double maybe
= dist
+ Math.
max(dp
[A
][a
],dp
[S
-A
][b
]); if(dp[S][a] < 0.1 || dp[S][a] > maybe)
dp[S][a] = maybe;
}
return dp[M-1][0];
}
Ly8gRXJyaWNodG8gLSBlYXN5CgogICAgcHVibGljIHN0YXRpYyBkb3VibGUgbWluVGltZShpbnRbXSB4LCBpbnRbXSB5KSB7CiAgICAgICAgaW50IG4gPSB4Lmxlbmd0aDsKICAgICAgICBpbnQgTSA9IDEgPDwgbjsKICAgICAgICBkb3VibGUgZHBbXVtdID0gbmV3IGRvdWJsZVtNXVtuXTsKICAgICAgICBmb3IoaW50IFMgPSAwOyBTIDwgTTsgKytTKQogICAgICAgICBmb3IoaW50IEEgPSAwOyBBIDwgTTsgKytBKQogICAgICAgICAgaWYoKFMgfCBBKSA9PSBTKQogICAgICAgICAgIGZvcihpbnQgYSA9IDA7IGEgPCBuOyArK2EpCiAgICAgICAgICAgIGZvcihpbnQgYiA9IDA7IGIgPCBuOyArK2IpCiAgICAgICAgICAgICBpZigoQSAmICgxIDw8IGEpKSA+IDApCiAgICAgICAgICAgICAgaWYoKFMgJiAoMSA8PCBiKSkgPiAwICYmIChBICYgKDEgPDwgYikpID09IDApIHsKICAgICAgICAgICAgICAgZG91YmxlIGRpc3QgPSBNYXRoLnNxcnQoTWF0aC5wb3coeFthXS14W2JdLDIpICsgTWF0aC5wb3coeVthXS15W2JdLDIpKTsKICAgICAgICAgICAgICAgZG91YmxlIG1heWJlID0gZGlzdCArIE1hdGgubWF4KGRwW0FdW2FdLGRwW1MtQV1bYl0pOwogICAgICAgICAgICAgICBpZihkcFtTXVthXSA8IDAuMSB8fCBkcFtTXVthXSA+IG1heWJlKQogICAgICAgICAgICAgICAgZHBbU11bYV0gPSBtYXliZTsKICAgICAgICAgICAgICB9CiAgICAgICAgcmV0dXJuIGRwW00tMV1bMF07CiAgICB9Cg==
Main.java:3: error: class, interface, or enum expected
public static double minTime(int[] x, int[] y) {
^
Main.java:5: error: class, interface, or enum expected
int M = 1 << n;
^
Main.java:6: error: class, interface, or enum expected
double dp[][] = new double[M][n];
^
Main.java:7: error: class, interface, or enum expected
for(int S = 0; S < M; ++S)
^
Main.java:7: error: class, interface, or enum expected
for(int S = 0; S < M; ++S)
^
Main.java:7: error: class, interface, or enum expected
for(int S = 0; S < M; ++S)
^
Main.java:8: error: class, interface, or enum expected
for(int A = 0; A < M; ++A)
^
Main.java:8: error: class, interface, or enum expected
for(int A = 0; A < M; ++A)
^
Main.java:10: error: class, interface, or enum expected
for(int a = 0; a < n; ++a)
^
Main.java:10: error: class, interface, or enum expected
for(int a = 0; a < n; ++a)
^
Main.java:11: error: class, interface, or enum expected
for(int b = 0; b < n; ++b)
^
Main.java:11: error: class, interface, or enum expected
for(int b = 0; b < n; ++b)
^
Main.java:15: error: class, interface, or enum expected
double maybe = dist + Math.max(dp[A][a],dp[S-A][b]);
^
Main.java:16: error: class, interface, or enum expected
if(dp[S][a] < 0.1 || dp[S][a] > maybe)
^
Main.java:18: error: class, interface, or enum expected
}
^
Main.java:20: error: class, interface, or enum expected
}
^
16 errors