# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
305945 | llaki | Packing Biscuits (IOI20_biscuits) | C++17 | 1086 ms | 16120 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <vector>
#include <map>
#include "biscuits.h"
long long count_tastiness(long long x, std::vector<long long> a) {
std::map<long long, long long> freq;
freq[a[0]] = 1;
for (int pos = 0; pos < a.size() - 1; pos++) {
std::map<long long, long long> map;
for (const auto &[y, value]: freq) {
long long val = a[pos + 1] + y / 2;
long long oldFreq = 0;
if (freq.find(val) != freq.end()) {
oldFreq = map[val];
}
map[val] = oldFreq + freq[y];
if (y >= x) {
val = a[pos + 1] + (y - x) / 2;
oldFreq = 0;
if (freq.find(val) != freq.end()) {
oldFreq = map[val];
}
map[val] = oldFreq + freq[y];
}
}
freq = map;
}
long long ans = 0;
for (const auto &[y, value]: freq) {
ans += value * (y / x + 1);
}
return ans;
}
Compilation message (stderr)
# | 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... |