제출 #908109

#제출 시각아이디문제언어결과실행 시간메모리
908109treap_enjoyerBali Sculptures (APIO15_sculpture)C++14
0 / 100
1 ms348 KiB
#include<bits/stdc++.h> #include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/tree_policy.hpp> #pragma GCC optimize("Ofast,unroll-loops") #define ll long long #define all(x) x.begin(), x.end() #define ld long double #define pii pair<int, int> using namespace std; using namespace __gnu_pbds; template<class T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; const ll INF = 1e15 + 7; const int MAXN = 1e5 + 5; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n, a, b; cin >> n >> a >> b; vector<int> ar(n + 1); vector<ll> pref(n + 1, 0); for(int i = 1; i <= n; i++){ cin >> ar[i]; pref[i] += pref[i - 1]; pref[i] += ar[i]; } vector<vector<ll> > dp(n + 1, vector<ll>(b + 1, INF)); for(int i = 1; i <= n; i++){ dp[i][1] = pref[i]; } for(int i = 2; i <= b; i++){ for(int j = 2; j <= n; j++){ for(int k = 1; k < j; k++){ dp[j][i] = min(dp[j][i], dp[k][i - 1] | (pref[j] - pref[k])); } } } cout << dp[n][b] << endl; }
#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...