Submission #602899

#TimeUsernameProblemLanguageResultExecution timeMemory
602899MohamedFaresNebiliPacking Biscuits (IOI20_biscuits)C++14
0 / 100
1081 ms15176 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;
            map<ll, ll> DP[60];
            ll solve(ll i, ll T) {
                if(i == 60) 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; ll res = 0;
                for(ll l = 0; l < 60; l++)
                    V.push_back((l < K ? A[l] : 0)),
              		DP[l].clear();
                return solve(0, 0);
            }

Compilation message (stderr)

biscuits.cpp: In function 'll count_tastiness(ll, std::vector<long long int>)':
biscuits.cpp:33:44: warning: unused variable 'res' [-Wunused-variable]
   33 |                 ll K = A.size(); N = X; ll res = 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...