Submission #333320

# Submission time Handle Problem Language Result Execution time Memory
333320 2020-12-05T13:07:41 Z nickmet2004 Packing Biscuits (IOI20_biscuits) C++14
0 / 100
2 ms 620 KB
#include<bits/stdc++.h>
#include "biscuits.h"
#define ll long long
using namespace std;
ll X;
ll dp[61] , Pr[61];
ll Q(ll a){
    if(a < 0ll)return 0;
    if(!a) return 1;
    int j;
    for(int j = 60; ~j; --j) if((1ll << j) <= a)break;
    return dp[j] + Q(min(a , Pr[j] / X) - (1ll << j));
}
ll count_tastiness(ll X , vector<ll> a){
    int n = a.size(); X = X;
    for(int i = 0; i < n; ++i) if(i)Pr[i] = Pr[i - 1] + a[i] * (1ll << i);
    dp[0] = 1;
    /// 2^k___2^(k+1) - 1
    /// dp[k + 1] = dp[k] + a;
    for(int k = 1; k < 61; ++k) dp[k] = Q((1ll << k) - 1);
    return dp[60];
}
//int main (){}

Compilation message

biscuits.cpp: In function 'long long int Q(long long int)':
biscuits.cpp:12:16: warning: 'j' may be used uninitialized in this function [-Wmaybe-uninitialized]
   12 |     return dp[j] + Q(min(a , Pr[j] / X) - (1ll << j));
      |            ~~~~^
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 8 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 8 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 8 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 620 KB Execution killed with signal 8 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 8 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -