Submission #585768

# Submission time Handle Problem Language Result Execution time Memory
585768 2022-06-29T10:20:01 Z LucaIlie Packing Biscuits (IOI20_biscuits) C++17
42 / 100
1000 ms 74396 KB
#include "biscuits.h"
#include <bits/stdc++.h>

using namespace std;

long long count_tastiness( long long x, vector <long long> a ) {
    const int k = 60;
    long long s, m;
    unordered_map <long, long long> dp[k];

    a.resize( k );

    s = 0;
    for ( int b = 0; b < k; b++ ) {
        a[b] += s;
        if ( a[b] > x ) {
            s = a[b] - x;
            a[b] = x + s % 2;
            s /= 2;
        } else
            s = 0;
    }

    dp[0][a[0]] = 1;
    if ( a[0] - x >= 0 )
        dp[0][a[0] - x] = 1;
    for ( int b = 1; b < k; b++ ) {
        for ( auto p: dp[b - 1] ) {
            s = p.first;
            m = p.second;
            dp[b][s / 2 + a[b]] += m;
            if ( s / 2 + a[b] - x >= 0 )
                dp[b][s / 2 + a[b] - x] += m;
        }
    }

    m = 0;
    for ( auto p: dp[k - 1] )
        m += p.second;

    return m;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 300 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 2 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 82 ms 26844 KB Output is correct
2 Correct 179 ms 14280 KB Output is correct
3 Correct 297 ms 23224 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 296 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 738 ms 27636 KB Output is correct
9 Correct 461 ms 19644 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 15 ms 892 KB Output is correct
12 Correct 122 ms 5324 KB Output is correct
13 Correct 765 ms 27832 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1081 ms 74396 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 300 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 2 ms 340 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 82 ms 26844 KB Output is correct
25 Correct 179 ms 14280 KB Output is correct
26 Correct 297 ms 23224 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 296 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 738 ms 27636 KB Output is correct
32 Correct 461 ms 19644 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 15 ms 892 KB Output is correct
35 Correct 122 ms 5324 KB Output is correct
36 Correct 765 ms 27832 KB Output is correct
37 Execution timed out 1081 ms 74396 KB Time limit exceeded
38 Halted 0 ms 0 KB -