Rezultati

Up. imeNalogaJezikRezultatČas oddaje
koklja-2017 Ribiči C++ 100/100OK 11. maj '17 @ 17:16

Test Točke Porabljen spomin Porabljen čas Status
#1 3/3 89,207 MiB 0,077 s OK
#2 3/3 89,656 MiB 0,077 s OK
#3 3/3 89,563 MiB 0,059 s OK
#4 3/3 94,469 MiB 0,098 s OK
#5 4/4 94,469 MiB 0,117 s OK
#6 4/4 94,363 MiB 0,104 s OK
#7 4/4 94,465 MiB 0,129 s OK
#8 4/4 94,469 MiB 0,300 s OK
#9 4/4 94,469 MiB 0,361 s OK
#10 4/4 91,801 MiB 0,136 s OK
#11 4/4 94,469 MiB 0,342 s OK
#12 4/4 94,469 MiB 0,123 s OK
#13 4/4 94,367 MiB 0,098 s OK
#14 4/4 94,367 MiB 0,123 s OK
#15 4/4 94,367 MiB 0,104 s OK
#16 4/4 94,371 MiB 0,355 s OK
#17 4/4 94,469 MiB 0,276 s OK
#18 4/4 89,148 MiB 0,053 s OK
#19 4/4 89,148 MiB 0,053 s OK
#20 4/4 89,145 MiB 0,053 s OK
#21 4/4 89,246 MiB 0,065 s OK
#22 4/4 94,473 MiB 0,356 s OK
#23 4/4 94,461 MiB 0,341 s OK
#24 4/4 89,559 MiB 0,065 s OK
#25 4/4 89,559 MiB 0,089 s OK
#26 4/4 89,559 MiB 0,089 s OK

Ocenjevani program (Ribici.cpp):
#include <iostream>
#include <complex>
#include <iomanip>
#include <climits>
#include <stack>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>

#define FOR(i,n) for(int i=0,_n=n;i<_n;i++)
#define FORR(i,s,n) for(int i=s,_n=n;i<_n;i++)
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define vi vector<int>
#define fs first
#define sec second
#define fi first
#define se second
#define INF (1LL<<50LL)

#define maxn 201100

using namespace std;
typedef long long ll;

const ll MOD = 1000000007LL;

ll n, d, k;
ll pre[maxn], arr[maxn];
ll dp[maxn][55];

ll fun(int x, int st){
    if(x > n || st == 0)
        return 0;
    
    ll &cur = dp[x][st];
    if(cur != -1)
        return cur;
    
    cur = max(cur, fun(x + 1, st));
    cur = max(cur, fun(x + d, st - 1) + pre[x + d - 1] - pre[x - 1]);
    return cur;
}



int main(){
    scanf("%lld%lld%lld", &n, &d, &k);
    for(int i = 1; i <= n; i++){
        scanf("%lld", arr + i);  
        pre[i] = pre[i - 1] + arr[i];
    }
    
    memset(dp, -1, sizeof(dp));
    
    cout << fun(1, k) << endl;
    
/*    for(int j = 50; j >= 0; j--){
        for(int i = n; i >= 0; i--){
            
        }
    } */
    
    
    
    return 0;
}