Submission #602923

#TimeUsernameProblemLanguageResultExecution timeMemory
602923MohamedFaresNebiliPacking Biscuits (IOI20_biscuits)C++14
42 / 100
1082 ms43372 KiB
#include <bits/stdc++.h> /// #pragma GCC optimize ("Ofast") /// #pragma GCC target ("avx2") /// #pragma GCC optimize("unroll-loops") using namespace std; using ll = long long; using ii = pair<ll, ll>; using vi = vector<int>; #define ff first #define ss second #define pb push_back #define all(x) (x).begin(), (x).end() #define lb lower_bound const int oo = 1000 * 1000 * 1000 + 7; ll N; vector<ll> V; unordered_map<ll, ll> DP[62]; ll solve(ll i, ll T) { if(i == 61) return 1; if(DP[i].count(T)) return DP[i][T]; ll best = 0; if(T + V[i] >= N) best += solve(i + 1, (T + V[i] - N) / 2); best += solve(i + 1, (T + V[i]) / 2); return DP[i][T] = best; } ll count_tastiness(ll X, vector<ll> A) { ll K = A.size(); N = X; V.clear(); for(ll l = 0; l <= 60; l++) V.push_back((l < K ? A[l] : 0)), DP[l].clear(); 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...