Submission #308302

# Submission time Handle Problem Language Result Execution time Memory
308302 2020-09-30T21:51:50 Z bruce_test Packing Biscuits (IOI20_biscuits) C++14
9 / 100
1000 ms 721128 KB
#include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define lc (rt<<1)
#define rc (rt<<1|1)
#define pb push_back
#define cl(a, b) memset(a, b, sizeof(a))
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pi> vii;
typedef vector<pii> viii;
const int inf = 0x3F3F3F3F;
const ll infl = 0x3F3F3F3F3F3F3F3FLL;
const int mod = 1e9 + 7, LOG=60;
ll cnt, psa[LOG]; unordered_map<ll, ll> mp;
ll fun(ll x){
    if(x < 0) return 0;
    if(x == 0) return 1LL;
    if(mp.count(x)) return mp[x];
    int p = 63 - __builtin_clzll(x);
    mp[x] = fun((1<<p)-1) + fun(min(x, psa[p]/cnt) - (1<<p));
    return mp[x];
}
ll count_tastiness(ll x, vl a){
    a.resize(LOG); cnt = x; mp.clear();
    psa[0] = a[0];
    for(int i=1; i<LOG; i++) psa[i] = psa[i-1] + a[i]*(1LL<<i);
    return fun((1LL<<LOG) - 1);
}
//int main(){
//    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
//    vl a = {5, 2, 1};
//    cout << count_tastiness(3, a) << endl;
//}

# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 0 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 0 ms 256 KB Output is correct
9 Correct 0 ms 256 KB Output is correct
10 Correct 0 ms 256 KB Output is correct
11 Correct 0 ms 256 KB Output is correct
12 Correct 1 ms 256 KB Output is correct
13 Correct 0 ms 256 KB Output is correct
14 Correct 1 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Execution timed out 1122 ms 559176 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1138 ms 649072 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Execution timed out 1136 ms 721128 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 0 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 0 ms 256 KB Output is correct
9 Correct 0 ms 256 KB Output is correct
10 Correct 0 ms 256 KB Output is correct
11 Correct 0 ms 256 KB Output is correct
12 Correct 1 ms 256 KB Output is correct
13 Correct 0 ms 256 KB Output is correct
14 Correct 1 ms 256 KB Output is correct
15 Correct 0 ms 256 KB Output is correct
16 Execution timed out 1122 ms 559176 KB Time limit exceeded
17 Halted 0 ms 0 KB -