Submission #425594

#TimeUsernameProblemLanguageResultExecution timeMemory
425594muhammad_hokimiyonPacking Biscuits (IOI20_biscuits)C++14
0 / 100
117 ms332 KiB
#include "biscuits.h" #include <bits/stdc++.h> using namespace std; long long count_tastiness(long long x, std::vector<long long> a) { long long ans = 1; vector<vector<long long>> d(101, vector<long long>(2, 0ll)); while((int)a.size() < 70)a.push_back(0ll); if(a[0] > 0)d[0][0] = 1,ans++; for(int i = 1; i < 61; i++){ for(int j = i - 1; j >= 0; j--){ for(int g = 0; g < 2; g++){ long long x = 0; for(int h = i - g; h > j; h--){ x += (1ll << h) * a[h]; } if(a[j] > 0)x += (1ll << j) * (a[j] - 1ll); if(x >= (1ll << i))d[i][g] += d[j][0]; if(a[j] > 0)x += (1ll << j); if(x >= (1ll << i))d[i][g] += d[j][1]; } } long long x = 0; for(int j = 0; j <= i; j++){ x += (1ll << j) * a[j]; } if(x >= (1ll << i))d[i][0]++; x -= (1ll << i) * a[i]; if(x >= (1ll << i))d[i][1]++; ans += d[i][0] + d[i][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...