이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
import java.util.*;
public class biscuits {
HashMap<Long, Long> freq = new HashMap<>();
long[] keys = new long[61 * 10001];
long[] vals = new long[61 * 10001];
long count_tastiness(long x, long[] a) {
freq.clear();
freq.put(a[0], 1l);
for (int pos = 0; pos < a.length - 1; pos++) {
int p = 0;
for (Map.Entry<Long, Long> entry : freq.entrySet()) {
keys[p] = entry.getKey();
vals[p] = entry.getValue();
p++;
}
freq.clear();
for (int i = 0; i < p; i++) {
long y = keys[i], value = vals[i];
long val = a[pos + 1] + (y >> 1);
freq.put(val, freq.getOrDefault(val, 0l) + value);
if (y >= x) {
val = a[pos + 1] + ((y - x) >> 1);
freq.put(val, freq.getOrDefault(val, 0l) + value);
}
}
}
long ans = 0;
for (long y : freq.keySet()) {
ans += freq.get(y) * (y / x + 1);
}
return ans;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |