(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

Submission #434662

#TimeUsernameProblemLanguageResultExecution timeMemory
43466279bruePacking Biscuits (IOI20_biscuits)C++14
100 / 100
57 ms1324 KiB
#include <bits/stdc++.h> #include "biscuits.h" using namespace std; typedef long long ll; ll arr[105]; ll val[105]; ll p2[105]; ll k; unordered_map<ll, ll> DP[102]; ll solve(int x, ll y){ if(x==0) return y+1; if(DP[x][y]) return DP[x][y]; ll ret = 0; ret += solve(x-1, min({val[x-1], y, p2[x]-1})); if(y >= p2[x]) ret += solve(x-1, min({val[x-1], y-p2[x], p2[x]-1})); return DP[x][y] = ret; } ll count_tastiness(ll _x, vector<ll> a) { k = _x; a.resize(60); for(int i=0; i<60; i++){ arr[i] = a[i]; DP[i].clear(); p2[i] = 1LL<<i; } for(int i=0; i<60; i++){ val[i] = 0; for(int j=0; j<=i; j++){ val[i] += arr[j] << j; } val[i] /= k; } return solve(59, val[59]); }
#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...