Rezultati

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

Test Točke Porabljen spomin Porabljen čas Status
#1 3/3 1,531 MiB 0,000 s OK
#2 3/3 35,770 MiB 0,029 s OK
#3 3/3 9,594 MiB 0,005 s OK
#4 3/3 38,906 MiB 0,111 s OK
#5 4/4 38,910 MiB 0,111 s OK
#6 4/4 38,906 MiB 0,111 s OK
#7 4/4 37,875 MiB 0,111 s OK
#8 4/4 37,914 MiB 0,105 s OK
#9 4/4 38,871 MiB 0,094 s OK
#10 4/4 23,945 MiB 0,034 s OK
#11 4/4 38,871 MiB 0,099 s OK
#12 4/4 2,242 MiB 0,038 s OK
#13 4/4 2,234 MiB 0,038 s OK
#14 4/4 2,281 MiB 0,038 s OK
#15 4/4 4,367 MiB 0,038 s OK
#16 4/4 38,910 MiB 0,082 s OK
#17 4/4 37,875 MiB 0,094 s OK
#18 4/4 1,527 MiB 0,000 s OK
#19 4/4 5,535 MiB 0,005 s OK
#20 4/4 5,535 MiB 0,005 s OK
#21 4/4 1,523 MiB 0,000 s OK
#22 4/4 38,871 MiB 0,083 s OK
#23 4/4 30,004 MiB 0,153 s OK
#24 4/4 15,598 MiB 0,011 s OK
#25 4/4 15,637 MiB 0,011 s OK
#26 4/4 19,637 MiB 0,011 s OK

Ocenjevani program (ribic.cpp):
#include <cstdio>
#include <vector>
#include <deque>
#define pb push_back
#define vi vector<int>
using namespace std;

const int N = 100000;
const int D = 100000;
const int K = 50;

int ff[K + 1][N + N + 2];
int Psum[N + 1];
int main(){
    int n,d,k,tmp;
    scanf("%d %d %d",&n,&d,&k);
    for(int i = 1;i <= n;i++){
        scanf("%d",&tmp);
        Psum[i] = Psum[i - 1] + tmp;
    }
    
    for(int tn = n; tn >= 1;tn--){
        for(int tk = 1; tk <= k;tk++){
            int ctc = Psum[tn + d - 1] - Psum[tn - 1];
            ff[tk][tn] = max(ff[tk][tn + 1], ff[tk - 1][tn + d] + ctc);
        }
    }
    
    printf("%d\n",ff[k][1]);
    
    return 0;
}