Submission #304889

#TimeUsernameProblemLanguageResultExecution timeMemory
304889MarcoMeijerPacking Biscuits (IOI20_biscuits)C++14
42 / 100
1062 ms10272 KiB
#include "biscuits.h" #include <bits/stdc++.h> using namespace std; // macros typedef long long ll; typedef long double ld; typedef pair<int, int> ii; typedef pair<ll, ll> lll; typedef tuple<int, int, int> iii; typedef vector<int> vi; typedef vector<ii> vii; typedef vector<iii> viii; typedef vector<ll> vll; typedef vector<lll> vlll; #define REP(a,b,c) for(int a=int(b); a<int(c); a++) #define RE(a,c) REP(a,0,c) #define RE1(a,c) REP(a,1,c+1) #define REI(a,b,c) REP(a,b,c+1) #define REV(a,b,c) for(int a=int(c-1); a>=int(b); a--) #define FOR(a,b) for(auto& a : b) #define all(a) a.begin(), a.end() #define INF 1e9 #define EPS 1e-9 #define pb push_back #define popb pop_back #define fi first #define se second #define sz size() const int MX=60, MX2=21000; ll x; vll a; ll dp[MX][MX2]; ll getDP(ll i, ll j) { if(j < 0) j = 0; if(j >= MX2) return 0; return dp[i][j]; } ll count_tastiness(ll X, vll A) { x=X; a=A; while(a.size() < MX) a.pb(0); RE(i,MX) { if(a[i] >= x+2) { ll rem = ((a[i]-x)/2ll)*2ll; a[i] -= rem; a[i+1] += rem/2ll; } } RE(i,MX) RE(j,MX2) { dp[i][j] = 0ll; if(i == 0) { ll remaining = a[i]-j; if(remaining >= 0) dp[i][j]++; if(remaining >= x) dp[i][j]++; continue; } dp[i][j] += getDP(i-1,(j-a[i])*2ll); dp[i][j] += getDP(i-1,(j+x-a[i])*2ll); } return dp[MX-1][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...