Submission #40484

#TimeUsernameProblemLanguageResultExecution timeMemory
40484WaschbarBali Sculptures (APIO15_sculpture)C++14
0 / 100
1079 ms1132 KiB
#include <bits/stdc++.h> #define st first #define nd second using namespace std; const long long INF = 1e9; const int MOD = 1e9+7; const int MAXN = 30000; int n, l, r; int v[100]; int func(int f, int k, int cnt, int sum, int orr) { int ans = INF; if(k > r) return INF; if(f == n+1) { if(k < l || k > r) return INF; //cout << f << " " << k << " " << (orr|sum) << endl; return orr|sum; } ans = func(f+1,k,cnt+1,sum+v[f],orr); if(cnt != 0) ans = min(ans,func(f+1,k+1,1,v[f],sum|orr)); return ans; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cin >> n >> l >> r; for(int i = 1; i <= n; i++) cin >> v[i]; cout << func(1,1,0,0,0); }
#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...