제출 #279628

#제출 시각아이디문제언어결과실행 시간메모리
279628srvltBali Sculptures (APIO15_sculpture)C++14
0 / 100
1 ms384 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define pb push_back #define all(x) begin(x), end(x) #define SZ(x) (int)(x).size() #define cps(x) sort(all(x)), (x).erase(unique(all(x)), end(x)) mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const int n0 = 103; int n, a, b; ll dp[n0][n0], v[n0], p[n0]; int main() { ios_base::sync_with_stdio(false), cin.tie(NULL); cin >> n >> a >> b; for (int i = 1; i <= n; i++) { cin >> v[i]; p[i] = p[i - 1] + v[i]; } memset(& dp, 0x3f, sizeof(dp)); ll res = dp[0][0]; dp[0][0] = 0; for (int i = 1; i <= b; i++) { for (int j = i; j <= n; j++) { for (int k = j - 1; k >= 0; k--) { dp[i][j] = min(dp[i][j], dp[i - 1][k] | (p[j] - p[k])); } } } for (int i = a; i <= b; i++) res = min(res, dp[i][n]); cout << res; }
#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...