Submission #479294

#TimeUsernameProblemLanguageResultExecution timeMemory
479294khoabrightPacking Biscuits (IOI20_biscuits)C++17
9 / 100
1212 ms1553824 KiB
#include "biscuits.h" #include <bits/stdc++.h> using namespace std; //#define int long long #define ff first #define ss second #define pii pair<int, int> #define all(x) x.begin(), x.end() #define rep(i, a, b) for (int i = (int)a; i <= (int)b; ++i) #define rep1(i, a, b) for (int i = (int)a; i >= (int)b; --i) #define mp make_pair #define vii vector<vector<int>> #define ll long long map<ll, ll> g; ll cal_g(ll n, ll x, vector<ll> &s) { //cout<<"n="<<n<<'\n'; if (n <= 0) return 0; if (n == 1) return 1; if (g.find(n) != g.end()) return g[n]; ll i = log2(n - 1); return g[n] = cal_g(1ll << i, x, s) + cal_g(min(n, 1 + s[i] / x) - (1ll << i), x, s); } ll count_tastiness(ll x, vector<ll> a) { g.clear(); for(int i=1; i<(int)a.size(); i++) { a[i] = a[i-1] + (a[i]<<i); } while(a.size()<=60) a.push_back(a.back()); return cal_g(1+a.back(), x, a); } // int main() { // ios_base::sync_with_stdio(0); // cin.tie(0); //cout.tie(0); // int t; cin >> t; // while(t--){ // long long x, k; // vector<long long> v; // cin >> k >> x; // v.resize(k); // rep(i, 0, k - 1) { // cin >> v[i]; // } // cout << count_tastiness(x, v) << '\n'; // } // }
#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...