Submission #479282

#TimeUsernameProblemLanguageResultExecution timeMemory
479282khoabrightPacking Biscuits (IOI20_biscuits)C++17
0 / 100
1155 ms1176704 KiB
#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 unordered_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; ll &tmp = g[n]; if (tmp > 0) return tmp; int i = log2(n - 1); tmp = cal_g(1ll << i, x, s) + cal_g(min(n, 1 + s[i] / x) - (1ll << i), x, s); return tmp; } ll count_tastiness(ll x, vector<ll> a) { int sz = 0; while (a.size() < 61) a.push_back(0); vector<ll> s(61); rep(i, 0, 60) { if (i) s[i] = s[i - 1]; s[i] += a[i] * (1ll << i); } return cal_g(s[60] + 1, x, s); } // 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'; // } // }

Compilation message (stderr)

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:32:9: warning: unused variable 'sz' [-Wunused-variable]
   32 |     int sz = 0;
      |         ^~
#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...