# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
498998 | 2021-12-27T02:42:33 Z | amukkalir | Bali Sculptures (APIO15_sculpture) | C++17 | 99 ms | 262148 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll INF = INT_MAX; const int nax = 2000; int a, b, n; ll y[nax+5]; int dp[51][505][550][25]; int f(int idx, ll sum, ll val, int grup) { if(grup > 20) return INF; int &res = dp[idx][sum][val][grup]; if(~res) return res; if(idx==n) res = (a <= grup && grup <= b) ? (val | (sum + y[n])) : INF; else res = min(f(idx+1, sum+y[idx], val, grup), f(idx+1, 0, val | (sum+y[idx]), grup+1)); cerr << idx << ' ' << sum << " " << val << " " << grup << " " << res << endl; return res; } int main() { scanf("%d %d %d", &n, &a, &b); for(int i=1; i<=n; i++) { scanf("%lld", &y[i]); } memset(dp, -1, sizeof (dp)); printf("%d", f(1, 0, 0, 1)); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 97 ms | 262148 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 87 ms | 262148 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 95 ms | 262148 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 99 ms | 262148 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 95 ms | 262148 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |