# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
546828 | brunnorezendes | Packing Biscuits (IOI20_biscuits) | C++17 | 349 ms | 26604 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 "biscuits.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long int int64;
typedef vector<int64> vi;
set <int64> s[2];
map <pair<int,int64> , int> mp;
int64 count_tastiness(int64 x, vi a){
int64 resp=0;
pair<int,int64> p;
s[0].insert(0);
int flag=0;
mp[{0, 0}] = 1;
for(int i=0;i<a.size();i++){
for(auto k: s[flag]){
if(k>=(x-a[i])){
mp[{i+1, (k-(x-a[i]))/2}] += mp[{i, k}];
s[!flag].insert((k-(x-a[i]))/2);
}
mp[{i+1, (k+a[i])/2}] += mp[{i, k}];
s[!flag].insert((k+a[i])/2);
}
s[flag].clear();
flag = !flag;
}
for(auto k: s[flag]){
resp += mp[{a.size(), k}];
}
return resp;
}
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... |