# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
305117 | 2020-09-22T15:35:58 Z | Sho10 | Packing Biscuits (IOI20_biscuits) | C++14 | 2 ms | 452 KB |
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho10 #define ll long long #define double long double #pragma GCC optimize("O3") #pragma GCC optimize("Ofast") #define all(a) (a).begin(), (a).end() #define sz size #define f first #define s second #define pb push_back #define er erase #define in insert #define mp make_pair #define pi pair #define rc(s) return cout<<s,0 #define endl '\n' #define mod 1000000007 #define PI 3.14159265359 #define MAXN 100005 #define INF 1000000005 #define LINF 1000000000000000005ll #define CODE_START ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); using namespace std; vector<ll>a; ll s[65],dp[65][65],x; ll solve(ll x,ll nr){ if(x==-1){ return 1; } ll &val=dp[x][nr]; if(val!=-1){ return val; } ll b=s[nr]&((1ll<<(x+1))-1); if(b>s[x]){ b=s[x]; nr=x; } val=0; if((1ll<<x)>b){ val+=solve(x-1,nr); }else { val+=solve(x-1,nr-1)+solve(x-1,nr); } return val; } ll count_tastiness(ll X,vector<ll>A){ x=X; for(ll i=0;i<A.size();i++) { a.pb(A[i]); } for(ll i=0;i<=60;i++){ s[i]=(1ll<<i)*a[i]; } for(ll i=0;i<=60;i++) { s[i]+=s[i-1]; } for(ll i=0;i<=60;i++) { s[i]/=x; } for(ll i=0;i<=60;i++) { s[i]=min(s[i],(1ll<<(i+1))-1); } return solve(59,59); } /* int32_t main(){ CODE_START; */
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 452 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |