제출 #844526

#제출 시각아이디문제언어결과실행 시간메모리
844526vjudge1Holding (COCI20_holding)C++14
88 / 110
32 ms262144 KiB
// Aber der schlimmste Fiend, dem du begegnen kannst, wirst du immer dir selber sein #include <bits/stdc++.h> #pragma GCC optimize("O3") #pragma GCC optimize("Ofast,unroll-loops") #pragma GCC target("avx2,popcnt,lzcnt,abm,bmi,bmi2,fma,tune=native") #define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL); #define ff first #define ss second #define pb push_back #define rev reverse #define all(x) x.begin(),x.end() #define acc accumulate #define sz size() #define MOD 1000000007 #define rall(x) x.rbegin(),x.rend() #define rep(i, x, n) for(int i = x; i < n; i++) using namespace std; const int N = 1e6 + 5; int a[101]; int n, l, r, k; int dp[101][101][10001]; int rec(int in, int in2, int left){ if(in2 == r) return 0; if(in == n) return MOD; if(dp[in][in2][left] != -1) return dp[in][in2][left]; int ans1 = rec(in+1, in2, left), ans2 = MOD; if(abs(in - in2) <= left) ans2 = rec(in+1, in2+1, left - abs(in - in2)) + a[in]; return dp[in][in2][left] = min(ans1, ans2); } inline void solve(){ cin >> n >> l >> r >> k; for(int i = 0; i < n; i++) cin >> a[i]; rep(i, 0, n) rep(j, 0, n) rep(ll, 0, k+1) dp[i][j][ll] = -1; cout << rec(0, l-1, k) << endl; } int main(){ fast_io int t; t = 1; while(t--) solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...