# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
589512 | 2022-07-04T19:27:25 Z | LucaIlie | Packing Biscuits (IOI20_biscuits) | C++17 | 1000 ms | 340 KB |
#include "biscuits.h" #include <bits/stdc++.h> using namespace std; long long countSolutions( int b, long long s, long long x, vector <long long> &a ) { int solutions; if ( b >= a.size() ) return 1; solutions = countSolutions( b + 1, (a[b] + s ) / 2, x, a ); if ( a[b] + s >= x ) solutions += countSolutions( b + 1, (a[b] + s - x) / 2, x, a ); return solutions; } 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;*/ return countSolutions( 0, 0, x, a ); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 21 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 2 ms | 212 KB | Output is correct |
4 | Correct | 31 ms | 212 KB | Output is correct |
5 | Correct | 7 ms | 212 KB | Output is correct |
6 | Correct | 73 ms | 212 KB | Output is correct |
7 | Correct | 6 ms | 212 KB | Output is correct |
8 | Correct | 72 ms | 300 KB | Output is correct |
9 | Correct | 12 ms | 304 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 28 ms | 308 KB | Output is correct |
13 | Correct | 17 ms | 212 KB | Output is correct |
14 | Correct | 1 ms | 296 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 21 ms | 212 KB | Output is correct |
2 | Execution timed out | 1091 ms | 212 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1079 ms | 212 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1088 ms | 340 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 21 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 2 ms | 212 KB | Output is correct |
4 | Correct | 31 ms | 212 KB | Output is correct |
5 | Correct | 7 ms | 212 KB | Output is correct |
6 | Correct | 73 ms | 212 KB | Output is correct |
7 | Correct | 6 ms | 212 KB | Output is correct |
8 | Correct | 72 ms | 300 KB | Output is correct |
9 | Correct | 12 ms | 304 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 28 ms | 308 KB | Output is correct |
13 | Correct | 17 ms | 212 KB | Output is correct |
14 | Correct | 1 ms | 296 KB | Output is correct |
15 | Correct | 21 ms | 212 KB | Output is correct |
16 | Execution timed out | 1091 ms | 212 KB | Time limit exceeded |
17 | Halted | 0 ms | 0 KB | - |