Submission #202369

# Submission time Handle Problem Language Result Execution time Memory
202369 2020-02-15T19:29:30 Z EmmanuelAC Holding (COCI20_holding) C++14
110 / 110
140 ms 44408 KB
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define pll pair<long long,long long>
using namespace std;

int n,l,r,k,dp[110][110][10010],a[110];
bool use[110][110][10010];

int fn(int pos,int cuantos,int m){
    if( cuantos==r-l+1 ) return 0;
    if( pos > n ) return 1+1e8;

    if( use[pos][cuantos][m] ) return dp[pos][cuantos][m];
    use[pos][cuantos][m] = true;

    int myAns = 0;
    myAns = fn( pos+1 , cuantos , m );
    if( m >= abs(l+cuantos-pos) ) myAns = min( myAns , a[pos]+fn( pos+1 , cuantos+1 , m-abs( l+cuantos-pos ) ) );

    return dp[pos][cuantos][m] = myAns;
}

int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin >> n >> l >> r >> k;
    for(int i=1; i<=n; i++) cin >> a[i];
    cout << fn( 1 , 0 , k );

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 504 KB Output is correct
2 Correct 5 ms 764 KB Output is correct
3 Correct 5 ms 1144 KB Output is correct
4 Correct 5 ms 1144 KB Output is correct
5 Correct 5 ms 1016 KB Output is correct
6 Correct 5 ms 1144 KB Output is correct
7 Correct 5 ms 892 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 504 KB Output is correct
2 Correct 5 ms 764 KB Output is correct
3 Correct 5 ms 1144 KB Output is correct
4 Correct 5 ms 1144 KB Output is correct
5 Correct 5 ms 1016 KB Output is correct
6 Correct 5 ms 1144 KB Output is correct
7 Correct 5 ms 892 KB Output is correct
8 Correct 6 ms 2936 KB Output is correct
9 Correct 7 ms 3832 KB Output is correct
10 Correct 10 ms 5368 KB Output is correct
11 Correct 12 ms 8184 KB Output is correct
12 Correct 12 ms 9720 KB Output is correct
13 Correct 16 ms 9340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 504 KB Output is correct
2 Correct 5 ms 764 KB Output is correct
3 Correct 5 ms 1144 KB Output is correct
4 Correct 5 ms 1144 KB Output is correct
5 Correct 5 ms 1016 KB Output is correct
6 Correct 5 ms 1144 KB Output is correct
7 Correct 5 ms 892 KB Output is correct
8 Correct 6 ms 2936 KB Output is correct
9 Correct 7 ms 3832 KB Output is correct
10 Correct 10 ms 5368 KB Output is correct
11 Correct 12 ms 8184 KB Output is correct
12 Correct 12 ms 9720 KB Output is correct
13 Correct 16 ms 9340 KB Output is correct
14 Correct 5 ms 1016 KB Output is correct
15 Correct 6 ms 2040 KB Output is correct
16 Correct 7 ms 3192 KB Output is correct
17 Correct 7 ms 3448 KB Output is correct
18 Correct 9 ms 5756 KB Output is correct
19 Correct 16 ms 9336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 504 KB Output is correct
2 Correct 5 ms 764 KB Output is correct
3 Correct 5 ms 1144 KB Output is correct
4 Correct 5 ms 1144 KB Output is correct
5 Correct 5 ms 1016 KB Output is correct
6 Correct 5 ms 1144 KB Output is correct
7 Correct 5 ms 892 KB Output is correct
8 Correct 6 ms 2936 KB Output is correct
9 Correct 7 ms 3832 KB Output is correct
10 Correct 10 ms 5368 KB Output is correct
11 Correct 12 ms 8184 KB Output is correct
12 Correct 12 ms 9720 KB Output is correct
13 Correct 16 ms 9340 KB Output is correct
14 Correct 5 ms 1016 KB Output is correct
15 Correct 6 ms 2040 KB Output is correct
16 Correct 7 ms 3192 KB Output is correct
17 Correct 7 ms 3448 KB Output is correct
18 Correct 9 ms 5756 KB Output is correct
19 Correct 16 ms 9336 KB Output is correct
20 Correct 15 ms 9464 KB Output is correct
21 Correct 7 ms 4216 KB Output is correct
22 Correct 11 ms 9336 KB Output is correct
23 Correct 7 ms 2552 KB Output is correct
24 Correct 49 ms 30584 KB Output is correct
25 Correct 140 ms 44408 KB Output is correct