Submission #1226303

#TimeUsernameProblemLanguageResultExecution timeMemory
1226303Theo830Packing Biscuits (IOI20_biscuits)C++17
0 / 100
26 ms5184 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll INF = 1e9+7; const ll MOD = 998244353; typedef pair<ll,ll> ii; #define iii pair<ll,ii> #define id pair<ll,vector<ll> > #define f(i,a,b) for(ll i = a;i < b;i++) #define pb push_back #define vll vector<ll> #define F first #define S second #define all(x) (x).begin(), (x).end() ///I hope I will get uprating and don't make mistakes ///I will never stop programming ///sqrt(-1) Love C++ ///Please don't hack me ///@TheofanisOrfanou Theo830 ///Think different approaches (bs,dp,greedy,graphs,shortest paths,mst) ///Stay Calm ///Look for special cases ///Beware of overflow and array bounds ///Think the problem backwards ///Training #include "biscuits.h" ll exo[65] = {0}; ll dp[10005][62]; ll X; ll solve(ll idx,ll b){ if(b == 62){ return 1; } ll posa = idx + exo[b]; ll ans = solve(posa / 2,b+1); if(posa >= X){ ans += solve((posa - X) / 2,b+1); } return dp[idx][b] = ans; } long long count_tastiness(long long x, std::vector<long long> a){ X = x; while(a.size() < 65){ a.pb(0); } f(i,0,64){ exo[i] += a[i]; if(exo[i] > x){ ll posa = exo[i] - x; exo[i+1] += posa / 2; posa %= 2; exo[i] += posa; } } memset(dp,-1,sizeof dp); return solve(0,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...