Submission #306058

#TimeUsernameProblemLanguageResultExecution timeMemory
306058loliconPacking Biscuits (IOI20_biscuits)C++14
9 / 100
1093 ms384 KiB
#include <bits/stdc++.h> #include "biscuits.h" using namespace std; #define int long long #define SZ(x) ((int)(x).size()) #define all(x) begin(x), end(x) bool chk(int v, int x, vector<int> cnt) { for(int i = 0; i < x; i++) { int val = v; for(int j = SZ(cnt) - 1; j >= 0; j--) { int need = min(cnt[j], val / (1LL << j)); cnt[j] -= need; val -= (1ll << j) * need; } if(val) return false; } return true; } int count_tastiness(int x, vector<int> a) { int k = a.size(); int sum = 0; for(int i = 0; i < k; i++) { sum = sum + (1LL << i) * a[i]; } int ret = 1; if(x == 1) { for(int i = k - 1; i > 0; i--) { if(a[i - 1] >= 2) { a[i - 1] = a[i - 1] + a[i] * 2LL; a[i] = 0; } } for(int i = 0; i < k; i++) { ret = ret * (a[i] + 1LL); } } else { for(int i = 1; i * x <= sum; i++) { if(chk(i, x, a)) ret++; } } return ret; }
#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...