Submission #1085464

#TimeUsernameProblemLanguageResultExecution timeMemory
1085464minggaBali Sculptures (APIO15_sculpture)C++17
0 / 100
1 ms604 KiB
#include "bits/stdc++.h" using namespace std; #define ln "\n" #define dbg(x) cout << #x << " = " << x << ln #define mp make_pair #define pb push_back #define fi first #define se second #define inf 2e18 #define fast_cin() \ ios_base::sync_with_stdio(false); \ cin.tie(NULL) #define out(file) freopen(file, "w", stdout) #define in(file) freopen(file, "r", stdin) #define all(x) (x).begin(), (x).end() #define sz(x) ((int)(x).size()) #define ll long long int MOD = 1e9 + 7; const int N = 2001; int y[N], a, b, n; ll ps[N], dp[N][N]; signed main() { fast_cin(); cin >> n >> a >> b; for(int i = 1; i <= n; i++) cin >> y[i], ps[i] = ps[i-1] + y[i]; for(int i = 1; i <= n; i++) { dp[i][0] = inf; } for(int j = 1; j <= b; j++) { for(int i = j; i <= n; i++) { dp[i][j] = inf; for(int t = j-1; t < i; t++) { ll cur = ps[i] - ps[t]; dp[i][j] = min(dp[i][j], dp[t][j-1] | cur); } } } // for(int i = 1; i <= n; i++) { // for(int j = 1; j <= b; j++) { // cout << dp[i][j] << ' '; // } // cout << ln; // } ll ans = inf; for(int j = a; j <= b; j++) ans = min(ans, dp[n][j]); cout << ans; cerr << "\nTime: " << clock() * 1000 / CLOCKS_PER_SEC; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...