제출 #1192114

#제출 시각아이디문제언어결과실행 시간메모리
1192114SofiatpcBali Sculptures (APIO15_sculpture)C++20
9 / 100
1095 ms444 KiB
#include <bits/stdc++.h> using namespace std; #define int long long const int MAXN = 2005; int v[MAXN], n, a, b, d[MAXN], ans; void bt(int i){ if(i == n+1){ int tot = 0, sum = 0, cur = d[1], qtd = 1; for(int j = 1; j <= n; j++){ if(cur != d[j]){ tot = tot | sum; cur = d[j]; sum = 0; qtd++; } sum += v[j]; } tot = tot | sum; if(qtd >= a && qtd <= b)ans = min(ans,tot); return; } d[i] = 1; bt(i+1); d[i] = 0; bt(i+1); } signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin>>n>>a>>b; for(int i = 1; i <= n; i++)cin>>v[i]; ans = 1e18; bt(1); cout<<ans<<"\n"; }
#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...