Submission #305931

#TimeUsernameProblemLanguageResultExecution timeMemory
305931llakiPacking Biscuits (IOI20_biscuits)Java
21 / 100
1200 ms99144 KiB
import java.util.HashMap; public class biscuits { long count_tastiness(long x, long[] a) { HashMap<Long, Long> freq = new HashMap<>(); freq.put(a[0], 1l); for (int pos = 0; pos < a.length - 1; pos++) { HashMap<Long, Long> map = new HashMap<>(); for (long y : freq.keySet()) { long val = a[pos + 1] + y / 2; Long oldFreq = map.get(val); map.put(val, (oldFreq != null ? oldFreq.longValue() : 0) + freq.get(y)); if (y >= x) { val = a[pos + 1] + (y - x) / 2; oldFreq = map.get(val); map.put(val, (oldFreq != null ? oldFreq.longValue() : 0) + freq.get(y)); } } freq = map; } long ans = 0; for (long y : freq.keySet()) { ans += freq.get(y) * (y / x + 1); } return ans; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...